detail.vue 9.6 KB

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