detail.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403
  1. <template>
  2. <div class="resourceDetail">
  3. <ul class="detailUl">
  4. <li class="detailLi">
  5. <span class="liName">当前企业</span>
  6. <span class="liInfo">{{ companyName }}</span>
  7. </li>
  8. <li class="detailLi">
  9. <span class="liName">位置</span>
  10. <span class="liInfo">{{ form.position }}</span>
  11. </li>
  12. <li class="detailLi">
  13. <span class="liName">容纳人数</span>
  14. <span class="liInfo">{{ form.seatNumber }}</span>
  15. </li>
  16. <li class="detailLi">
  17. <span class="liName">配套</span>
  18. <span class="liInfo">{{ form.matchGoods }}</span>
  19. </li>
  20. <li class="detailLi">
  21. <span class="liName">说明</span>
  22. <span class="liInfo">{{ form.remark }}</span>
  23. </li>
  24. <li class="detailLi" style="border-bottom: none">
  25. <span class="liName">
  26. <span class="callName">预约电话:</span>
  27. <span class="callNumber">{{ form.appointPhone }}</span>
  28. </span>
  29. <img src="https://www.idea-co-sf.com/gardenProduct/image/phoneIcon.png" class="phoneIcon">
  30. </li>
  31. </ul>
  32. <div class="timeBox">
  33. <div>日期</div>
  34. <div style="margin-left: 110rpx">
  35. <span @click="showTime('startTime')">{{startTime}} </span>
  36. <span @click="showTime('endTime')">{{ endTime }} </span>
  37. </div>
  38. </div>
  39. <div class="bottomTableBody">
  40. <div class="ModelBox">
  41. <div class="modelT">
  42. <div class="model model1"></div>
  43. 空置
  44. </div>
  45. <div class="modelT">
  46. <div class="model model2"></div>
  47. 已占用
  48. </div>
  49. <div class="modelT">
  50. <div class="model model3"></div>
  51. 冻结中
  52. </div>
  53. </div>
  54. <div class="table_Xuan">
  55. <div class="firstColBox">
  56. <div class="tableHead">
  57. <div class="tableFirstCol" style="background: rgba(245, 247, 250, 1)">日期/时间段</div>
  58. </div>
  59. <div class="tableRow" v-for="item in timeList">
  60. <div class="tableFirstCol">{{item.date}}</div>
  61. </div>
  62. </div>
  63. <div class="colBox">
  64. <div class="tableHead">
  65. <div v-for="timeItem in timeList[0].time" class="tableCol" style="background: rgba(245, 247, 250, 1)">{{timeItem.timeInterval}}</div>
  66. </div>
  67. <div class="tableRow" v-for="item in timeList">
  68. <div v-for="timeItem in item.time" class="tableCol" :class="timeItem.type=='2'?'ppBg':timeItem.type=='3'?'orBg':''"></div>
  69. </div>
  70. </div>
  71. </div>
  72. </div>
  73. <button class="toYy" @tap="toAdd">去预约</button>
  74. <van-popup
  75. :show="timeShow"
  76. position="bottom"
  77. custom-style="height: 50%;"
  78. >
  79. <van-datetime-picker
  80. type="date"
  81. :value="currentDate"
  82. :formatter="formatter"
  83. @cancel="timeShow=false"
  84. @confirm="selectTime"
  85. />
  86. </van-popup>
  87. </div>
  88. </template>
  89. <script>
  90. import {meetingRoomDetail, getUserLocalStorageInfo, roomTimeSoltDetail} from "@/js_sdk/http";
  91. import dayjs from "dayjs";
  92. export default {
  93. name: "detail",
  94. data() {
  95. return {
  96. getUserLocalStorageInfo: getUserLocalStorageInfo(),
  97. timeList: [
  98. // {date: '5/21', time: [{timeInterval: '9:00~12:00', type: 2}, {timeInterval: '13:00~18:00', type: 0},]},
  99. // {date: '5/22', time: [{timeInterval: '9:00~12:00', type: 0}, {timeInterval: '13:00~18:00', type: 3},]},
  100. ],
  101. form: {
  102. enterpriseId: getUserLocalStorageInfo().userId,
  103. companyName: getUserLocalStorageInfo().username,
  104. },
  105. id: '',
  106. timePickerType: '',
  107. time1Str:'',
  108. time2Str:'',
  109. regTime1Str:'',
  110. companyName: getUserLocalStorageInfo().username,
  111. timeShow:false,
  112. currentDate: new Date().getTime(),
  113. startTime: '开始时间',
  114. endTime: '结束时间'
  115. }
  116. },
  117. onLoad(options) {
  118. this.id = options.id
  119. this.getById()
  120. let startTime = dayjs().format('YYYY-MM-DD')
  121. let endTime = dayjs().add(6, 'day').format('YYYY-MM-DD')
  122. this.startTime = startTime
  123. this.endTime = endTime
  124. this.roomTimeSoltSeach()
  125. },
  126. methods: {
  127. getById() {
  128. const data = {
  129. id: this.id
  130. }
  131. meetingRoomDetail(data).then(res => {
  132. if (res.code === 200) {
  133. this.form = res.data
  134. }
  135. })
  136. },
  137. showTime(e){
  138. this.timePickerType = e
  139. this.timeShow = true
  140. },
  141. // 时间戳转换方法
  142. timestampToDate(timestamp) {
  143. const date = new Date(timestamp); // 如果timestamp是字符串,确保它是整数:parseInt(timestamp)
  144. const year = date.getFullYear();
  145. const month = (date.getMonth() + 1).toString().padStart(2, '0');
  146. const day = date.getDate().toString().padStart(2, '0');
  147. const hours = date.getHours().toString().padStart(2, '0');
  148. const minutes = date.getMinutes().toString().padStart(2, '0');
  149. const seconds = date.getSeconds().toString().padStart(2, '0');
  150. return `${year}-${month}-${day}`;
  151. },
  152. roomTimeSoltSeach() {
  153. if (this.startTime !== '' && this.startTime !== null && this.startTime !== undefined &&
  154. this.endTime !== '' && this.endTime !== null && this.endTime !== undefined) {
  155. this.roomTimeSolt()
  156. } else {
  157. Toast('请选择时间区间')
  158. }
  159. },
  160. // 获取会议室时段开放状态
  161. roomTimeSolt() {
  162. const reqData = {
  163. id: this.id,
  164. startTime: this.startTime,
  165. endTime: this.endTime
  166. }
  167. roomTimeSoltDetail(reqData).then((res) => {
  168. this.timeList = []
  169. if (res.key == 200) {
  170. this.timeList = res.data
  171. }
  172. })
  173. },
  174. toAdd() {
  175. uni.navigateTo({
  176. url: '/pages/subPackages/resourceReservation_manage/add?meetingRoomId=' + this.id
  177. })
  178. },
  179. // 时间选择单位
  180. formatter(type, val) {
  181. if (type === 'year') {
  182. return `${val}年`;
  183. } else if (type === 'month') {
  184. return `${val}月`;
  185. }else if (type === 'day') {
  186. return `${val}日`;
  187. }else if (type === 'hour') {
  188. return `${val}时`;
  189. }else if (type === 'minute') {
  190. return `${val}分`;
  191. }
  192. return val;
  193. },
  194. selectTime(e){
  195. const dateString = this.timestampToDate(e.detail);
  196. if(this.timePickerType === 'startTime'){
  197. this.time1Str = e.detail
  198. if (this.time2Str){
  199. if (this.time1Str > this.time2Str){
  200. this.$showToast("请选择合理时间");
  201. return
  202. }else{
  203. this.startTime = dateString
  204. }
  205. }else{
  206. this.startTime = dateString
  207. }
  208. }else if(this.timePickerType === 'endTime'){
  209. this.time2Str = e.detail
  210. if (this.time1Str){
  211. if (this.time1Str > this.time2Str){
  212. this.$showToast("请选择合理时间");
  213. return
  214. }else{
  215. this.endTime = dateString
  216. }
  217. }else{
  218. this.endTime = dateString
  219. }
  220. }
  221. this.timeShow = false
  222. this.roomTimeSoltSeach()
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="scss">
  228. .resourceDetail {
  229. padding-bottom: 48rpx;
  230. .detailUl {
  231. margin-top: 20rpx;
  232. background: white;
  233. padding: 24rpx 32rpx;
  234. .liName {
  235. font-size: 32rpx;
  236. color: rgba(51, 51, 51, 1);
  237. white-space: nowrap;
  238. .callNumber {
  239. color: rgba(24, 23, 42, 1);
  240. font-size: 36rpx;
  241. font-weight: 600;
  242. }
  243. .callName {
  244. color: rgba(102, 102, 102, 1);
  245. font-size: 28rpx;
  246. }
  247. }
  248. .phoneIcon {
  249. width: 64rpx;
  250. height: 64rpx;
  251. }
  252. .detailLi {
  253. display: flex;
  254. justify-content: space-between;
  255. align-items: center;
  256. padding: 32rpx 0;
  257. border-bottom: 2rpx solid #E6E6E6;
  258. .liInfo {
  259. display: inline-block;
  260. text-align: right;
  261. max-width: 428rpx;
  262. color: rgba(102, 102, 102, 1);
  263. font-size: 32rpx;
  264. line-height: 38rpx;
  265. overflow: hidden;
  266. word-wrap: break-word;
  267. }
  268. }
  269. }
  270. .timeBox {
  271. background: white;
  272. padding: 32rpx;
  273. display: flex;
  274. color: rgba(51, 51, 51, 1);
  275. font-size: 32rpx;
  276. margin: 24rpx 0;
  277. }
  278. .bottomTableBody {
  279. padding: 36rpx 24rpx;
  280. background: white;
  281. .ModelBox {
  282. display: flex;
  283. justify-content: center;
  284. font-size: 28rpx;
  285. .modelT {
  286. display: flex;
  287. margin: 0 30rpx;
  288. align-items: center;
  289. }
  290. .model {
  291. width: 28rpx;
  292. height: 28rpx;
  293. margin-right: 16rpx;
  294. }
  295. .model1 {
  296. border: 2rpx solid rgba(233, 233, 233, 1);
  297. }
  298. .model2 {
  299. background: rgba(142, 139, 228, 1);
  300. }
  301. .model3 {
  302. background: rgba(255, 182, 102, 1);
  303. }
  304. }
  305. .table_Xuan {
  306. position: relative;
  307. width: 702rpx;
  308. margin-top: 22rpx;
  309. display: flex;
  310. align-items: center;
  311. .firstColBox {
  312. display: flex;
  313. flex-direction: column;
  314. }
  315. .colBox {
  316. display: flex;
  317. flex-direction: column;
  318. overflow: hidden;
  319. overflow-x: scroll;
  320. width: 512rpx;
  321. }
  322. .tableHead {
  323. display: flex;
  324. font-size: 28rpx;
  325. }
  326. .tableRow {
  327. display: flex;
  328. }
  329. .tableFirstCol {
  330. z-index: 1;
  331. min-width: 192rpx;
  332. height: 80rpx;
  333. display: flex;
  334. align-items: center;
  335. justify-content: center;
  336. font-size: 28rpx;
  337. color: rgba(102, 102, 102, 1);
  338. border: 1px solid lightgray;
  339. background: white;
  340. }
  341. .tableCol {
  342. position: relative;
  343. z-index: 0;
  344. min-width: 250rpx;
  345. height: 80rpx;
  346. display: flex;
  347. align-items: center;
  348. justify-content: center;
  349. border: 1px solid lightgray;
  350. }
  351. .ppBg {
  352. background: rgba(142, 139, 228, 1);
  353. }
  354. .orBg {
  355. background: rgba(255, 182, 102, 1);
  356. }
  357. }
  358. }
  359. .toYy {
  360. width: 654rpx;
  361. height: 96rpx;
  362. background: rgba(3, 101, 249, 1);
  363. margin: 64rpx 48rpx;
  364. display: flex;
  365. align-items: center;
  366. justify-content: center;
  367. font-size: 36rpx;
  368. color: white;
  369. }
  370. }
  371. </style>