roomPrice.vue 39 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510
  1. <template>
  2. <div class="content-box">
  3. <div class="left">
  4. <!-- <el-icon :size="23" class="camera"><VideoCameraFilled /></el-icon> -->
  5. <span class="cameratxt">房价管理</span>
  6. </div>
  7. <div class="tabData">
  8. <div class="middle">
  9. <div class="filter">
  10. <div class="filter_block">
  11. <div class="condition">
  12. <el-date-picker
  13. v-model="searchInput.createTime"
  14. type="date"
  15. format="YYYY-MM-DD HH:mm:ss"
  16. value-format="YYYY-MM-DD HH:mm:ss"
  17. :prefix-icon="Calendar"
  18. :clearable="false"
  19. placeholder="请选择日期"
  20. @change="searchData"
  21. />
  22. </div>
  23. <div class="condition">
  24. <span>房型 : </span>
  25. <el-select
  26. v-model="searchInput.changePriceSelId"
  27. class="m-2"
  28. placeholder="请选择房型"
  29. @change="searchData"
  30. @clear="searchData"
  31. clearable
  32. style="width: 200px"
  33. >
  34. <el-option
  35. :label="i.roomName"
  36. :value="i.id"
  37. v-for="i in houseTypeData"
  38. :key="i.id"
  39. />
  40. <!-- <el-option label="标准房" value="标准房" /> -->
  41. </el-select>
  42. </div>
  43. </div>
  44. <div class="filter_block">
  45. <el-button
  46. style="margin-left: 20px"
  47. color="rgba(0, 97, 255, 1)"
  48. type="primary"
  49. class="search"
  50. @click="roomClose"
  51. ><span>批量改价</span></el-button
  52. >
  53. <el-button
  54. style="margin-left: 20px"
  55. color="rgba(0, 97, 255, 1)"
  56. type="primary"
  57. class="search"
  58. @click="recordPrice"
  59. ><span>改价记录</span></el-button
  60. >
  61. </div>
  62. </div>
  63. </div>
  64. <div class="footer" v-loading="loading">
  65. <el-table
  66. :data="tableData.list"
  67. style="width: 100%"
  68. :header-cell-style="{
  69. background: 'rgba(240, 243, 247, 1)',
  70. height: '50px',
  71. }"
  72. >
  73. <el-table-column align="center" width="200" prop="houseName" label="本地房型" />
  74. <el-table-column
  75. v-for="(item, index) in tableHead"
  76. align="center"
  77. :key="index"
  78. :label="item.dateTime"
  79. width="220"
  80. >
  81. <template #default="{ row }">
  82. <span>¥{{ row.housePriceVos[index].price }}</span>
  83. </template>
  84. </el-table-column>
  85. </el-table>
  86. </div>
  87. <!-- 批量改价 -->
  88. <el-dialog
  89. class="roomCloseDilog"
  90. v-model="roomCloseDialogVisible"
  91. :close-on-click-modal="false"
  92. :close-on-press-escape="false"
  93. title="批量改价"
  94. align-center
  95. width="700"
  96. :before-close="cancelRoomClose"
  97. >
  98. <div class="last">
  99. <div class="roomUl">
  100. <div class="title">选择类型</div>
  101. <div class="delRoom">
  102. <el-select
  103. v-model="changePriceSelData"
  104. class="m-2"
  105. placeholder="请选择类型"
  106. >
  107. <el-option label="全日房" value="1" />
  108. <el-option label="钟点房" value="2" />
  109. </el-select>
  110. </div>
  111. </div>
  112. <div class="roomUl">
  113. <div class="title">选择房型</div>
  114. <div class="delRoom">
  115. <el-checkbox-group
  116. @change="changePriceSelcet"
  117. v-model="changePriceSelData"
  118. >
  119. <el-checkbox
  120. :label="i.id"
  121. v-for="i in changePirceRoomType"
  122. :key="i.id"
  123. >{{ i.hName }}</el-checkbox
  124. >
  125. </el-checkbox-group>
  126. </div>
  127. </div>
  128. <div class="roomUl roomTime">
  129. <div class="title">选择日期</div>
  130. <div class="delRoom">
  131. <div class="date">适用日期</div>
  132. <div class="addDate">
  133. <div class="elDate">
  134. <div
  135. class="time_li"
  136. v-for="(i, index) in changePrice.createTime"
  137. :key="index"
  138. >
  139. <el-date-picker
  140. v-model="changePrice.createTime[index]"
  141. type="daterange"
  142. range-separator="至"
  143. start-placeholder="起始时间"
  144. end-placeholder="结束时间"
  145. format="YYYY-MM-DD"
  146. value-format="YYYY-MM-DD"
  147. :prefix-icon="Calendar"
  148. placeholder="请选择日期"
  149. />
  150. <img
  151. src="@/assets/addRoom.png"
  152. v-if="changePrice.createTime.length > 1"
  153. alt=""
  154. @click="delChangePriceTime(index)"
  155. />
  156. </div>
  157. </div>
  158. <div class="addTime">
  159. <div class="imgTime" @click="addChangePriceTime">
  160. <img src="@/assets/addRoom.png" alt="" />
  161. <span>添加时间段</span>
  162. </div>
  163. <span class="num">最多可添加10个</span>
  164. </div>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="roomUl">
  169. <div class="title">设置价格</div>
  170. <div class="delRoom">
  171. <el-table
  172. :row-class-name="tableRowClassName"
  173. :data="changePriceData.list"
  174. style="width: 100%; height: 280px"
  175. :header-cell-style="{
  176. background: 'rgba(233, 242, 242, 1)',
  177. height: '40px',
  178. border: 0,
  179. }"
  180. >
  181. <el-table-column align="center" prop="hName" label="房型" />
  182. <el-table-column align="center" />
  183. <el-table-column align="center" label="价格" width="200">
  184. <template #default="{ row }">
  185. <div @click="inputPrice(row)">
  186. <span v-if="row.inputPriceShow">{{ row.price }}</span>
  187. <el-input
  188. v-else
  189. :clearable="false"
  190. ref="inputPriceRef"
  191. @blur="inputPriceBlur(row)"
  192. v-model="row.price"
  193. class="w-50 m-2"
  194. placeholder="请输入价格"
  195. />
  196. </div>
  197. </template>
  198. </el-table-column>
  199. </el-table>
  200. </div>
  201. </div>
  202. <div class="options">
  203. <el-button
  204. class="queding"
  205. color="rgba(0, 97, 255, 1)"
  206. @click="notarizeRoomClose(roomCloseTree)"
  207. >确认</el-button
  208. >
  209. <el-button @click="cancelRoomClose">取消</el-button>
  210. </div>
  211. </div>
  212. </el-dialog>
  213. <!-- 改价记录 -->
  214. <el-dialog
  215. class="recordDilog"
  216. v-model="recordDialogVisible"
  217. :close-on-click-modal="false"
  218. :close-on-press-escape="false"
  219. title="改价记录"
  220. align-center
  221. width="1400"
  222. :before-close="cancelRecord"
  223. >
  224. <div class="middle">
  225. <div class="filter">
  226. <div class="condition">
  227. <span>房型 : </span>
  228. <el-select
  229. v-model="recordSearch.roomType"
  230. class="m-2"
  231. placeholder="请选择房型"
  232. @clear="recordPriceSearch"
  233. clearable
  234. style="width: 200px"
  235. >
  236. <el-option
  237. :label="i.hName"
  238. :value="i.id"
  239. v-for="i in recordRoomType"
  240. :key="i.id"
  241. />
  242. </el-select>
  243. </div>
  244. <div class="condition">
  245. <span>操作时间 : </span>
  246. <el-date-picker
  247. v-model="recordSearch.operationTime"
  248. type="daterange"
  249. range-separator="-"
  250. start-placeholder="起始时间"
  251. end-placeholder="结束时间"
  252. format="YYYY-MM-DD"
  253. value-format="YYYY-MM-DD"
  254. :prefix-icon="Calendar"
  255. placeholder="请选择日期"
  256. />
  257. </div>
  258. <div class="condition">
  259. <span>价格日期 : </span>
  260. <el-date-picker
  261. v-model="recordSearch.setDate"
  262. type="daterange"
  263. range-separator="-"
  264. start-placeholder="起始时间"
  265. end-placeholder="结束时间"
  266. format="YYYY-MM-DD"
  267. value-format="YYYY-MM-DD"
  268. :prefix-icon="Calendar"
  269. placeholder="请选择日期"
  270. />
  271. </div>
  272. <div class="condition">
  273. <span>操作人 : </span>
  274. <el-input
  275. :clearable="true"
  276. @clear="recordPriceSearch"
  277. v-model="recordSearch.keyWord"
  278. class="w-50 m-2"
  279. placeholder="请输入操作人名字"
  280. style="width: 230px"
  281. />
  282. </div>
  283. <el-button
  284. style="margin-left: 20px"
  285. color="rgba(0, 97, 255, 1)"
  286. type="primary"
  287. class="search"
  288. @click="recordPriceSearch"
  289. ><el-icon>
  290. <Search />
  291. </el-icon>
  292. <span>查询</span></el-button
  293. >
  294. <el-button
  295. style="margin-left: 20px"
  296. color="rgba(0, 97, 255, 1)"
  297. type="primary"
  298. class="search"
  299. @click="importExcel"
  300. ><span>导出房价</span></el-button
  301. >
  302. </div>
  303. </div>
  304. <div class="footer" v-loading="loading">
  305. <el-table
  306. :row-class-name="tableRowClassName2"
  307. :data="recordData.list"
  308. @selection-change="handleSelectionChange"
  309. style="width: 100%; height: 550px"
  310. :header-cell-style="{
  311. background: 'rgba(240, 243, 247, 1)',
  312. height: '50px',
  313. border: 0,
  314. }"
  315. >
  316. <el-table-column align="center" prop="houseName" label="房型">
  317. </el-table-column>
  318. <el-table-column align="center" prop="setDate" label="价格日期" />
  319. <el-table-column align="center" prop="price" label="修改后价格" />
  320. <el-table-column
  321. align="center"
  322. prop="operationName"
  323. label="操作人"
  324. />
  325. <el-table-column
  326. align="center"
  327. prop="operationTime"
  328. label="操作时间"
  329. >
  330. </el-table-column>
  331. </el-table>
  332. </div>
  333. <div class="pageSize">
  334. <span></span>
  335. <el-pagination
  336. background
  337. :current-page="recordPage"
  338. :page-size="recordSize"
  339. layout="total, prev, pager, next, jumper, slot"
  340. :total="recordTotal"
  341. @update:current-page="handleCurrentChange2"
  342. />
  343. </div>
  344. </el-dialog>
  345. <!-- 分页组件 -->
  346. <div class="pageSize">
  347. <span></span>
  348. <el-pagination
  349. background
  350. :current-page="currentPage"
  351. :page-size="pageSize"
  352. layout="total, prev, pager, next, jumper, slot"
  353. :total="total"
  354. @update:current-page="handleCurrentChange"
  355. />
  356. </div>
  357. </div>
  358. </div>
  359. </template>
  360. <script setup>
  361. import {
  362. ref,
  363. reactive,
  364. nextTick,
  365. watch,
  366. onBeforeMount,
  367. onUnmounted,
  368. } from "vue";
  369. import { useRouter } from "vue-router";
  370. import { ElMessage, ElMessageBox } from "element-plus";
  371. import { Calendar } from "@element-plus/icons-vue";
  372. import vidiconsApi from "@/api/vidicons.js";
  373. import { dayjs } from "element-plus";
  374. import lodash from "lodash";
  375. import axios from "axios";
  376. import { useStore } from "vuex";
  377. const store = useStore();
  378. const api = ref("");
  379. const router = useRouter();
  380. // 表格数据(-----------------------------------)
  381. const loading = ref(false);
  382. const tableHead = ref([
  383. {
  384. data: "2023-08-10",
  385. roomY: "剩2间房",
  386. },
  387. {
  388. data: "2023-08-11",
  389. roomY: "剩6间房",
  390. },
  391. {
  392. data: "2023-08-12",
  393. roomY: "剩2间房",
  394. },
  395. {
  396. data: "2023-08-13",
  397. roomY: "剩6间房",
  398. },
  399. {
  400. data: "2023-08-14",
  401. roomY: "剩2间房",
  402. },
  403. {
  404. data: "2023-08-15",
  405. roomY: "剩6间房",
  406. },
  407. ]); // 表头循环日期
  408. const tableData = reactive({
  409. list: [
  410. {
  411. orderNum: "双人床",
  412. money: 78,
  413. inputPriceShow: true,
  414. dataList: [
  415. {
  416. data: "2023-08-10",
  417. money: "120",
  418. },
  419. {
  420. data: "2023-08-11",
  421. money: "130",
  422. },
  423. {
  424. data: "2023-08-12",
  425. money: "140",
  426. },
  427. {
  428. data: "2023-08-13",
  429. money: "150",
  430. },
  431. {
  432. data: "2023-08-14",
  433. money: "160",
  434. },
  435. {
  436. data: "2023-08-15",
  437. money: "170",
  438. },
  439. ],
  440. },
  441. {
  442. orderNum: "单人床",
  443. money: 37,
  444. inputPriceShow: true,
  445. dataList: [
  446. {
  447. data: "2023-08-10",
  448. money: "120",
  449. },
  450. {
  451. data: "2023-08-11",
  452. money: "130",
  453. },
  454. {
  455. data: "2023-08-12",
  456. money: "140",
  457. },
  458. {
  459. data: "2023-08-13",
  460. money: "150",
  461. },
  462. {
  463. data: "2023-08-14",
  464. money: "160",
  465. },
  466. {
  467. data: "2023-08-15",
  468. money: "170",
  469. },
  470. ],
  471. },
  472. ],
  473. });
  474. const currentPage = ref(1); // 当前页
  475. const pageSize = ref(10);
  476. const total = ref(); // 当前总数
  477. // 下拉框数据
  478. const changePriceSelect = ref();
  479. // const selectData = reactive({ list: [] }); // 多选框选择的数据
  480. // 搜索按钮数据
  481. const searchInput = reactive({
  482. changePriceSelId: "",
  483. createTime: '',
  484. });
  485. const houseTypeData=ref()// 房型数据
  486. const addDialogVisible = ref(false); // 控制添加员工弹窗
  487. // 批量改价数据(---------------------------------------)
  488. const roomCloseDialogVisible = ref(false);
  489. const inputPriceRef = ref();
  490. const changePirceRoomType = ref(); // 批量改价房间类型
  491. const changePrice = reactive({
  492. createTime: [[]],
  493. });
  494. const changePriceSelData = ref(); // 选中的房间数据
  495. // 批量改价表格数据
  496. const changePriceData = reactive({ list: [] });
  497. // 改价记录数据(---------------------------------------)
  498. const recordDialogVisible = ref(false);
  499. const recordData = reactive({ list: [] }); // 改价记录数据
  500. const recordPage = ref(1); // 当前页
  501. const recordSize = ref(10); // 页数
  502. const recordTotal = ref(10); // 页数
  503. const recordRoomType = ref(); // 房间类型
  504. const recordSearch = reactive({
  505. operationTime: "",
  506. keyWord: "",
  507. roomType: "",
  508. setDate: "",
  509. });
  510. // 表单验证
  511. const rules = reactive({
  512. // serial: [{ required: true, message: "序列号不能为空", trigger: "blur" }],
  513. userName: [{ required: true, message: "姓名不能为空", trigger: "blur" }],
  514. cardNumber: [
  515. { required: true, message: "微校卡号不能为空", trigger: "blur" },
  516. ],
  517. userzzId: [{ required: true, message: "身份不能为空", trigger: "blur" }],
  518. userPhone: [{ required: true, message: "手机号码不能为空", trigger: "blur" }],
  519. schoolId: [{ required: true, message: "校区不能为空", trigger: "blur" }],
  520. workType: [{ required: true, message: "工种不能为空", trigger: "blur" }],
  521. teamId: [{ required: true, message: "维修班不能为空", trigger: "blur" }],
  522. articleIds: [
  523. { required: true, message: "关联报修类型不能为空", trigger: "blur" },
  524. ],
  525. buildIds: [{ required: true, message: "关联楼栋不能为空", trigger: "blur" }],
  526. acceptanceTime: [
  527. { required: true, message: "接单考核时间不能为空", trigger: "blur" },
  528. ],
  529. maintenanceTime: [
  530. { required: true, message: "维修考核时间不能为空", trigger: "blur" },
  531. ],
  532. });
  533. // 改价记录 操作时间
  534. watch(
  535. () => recordSearch.operationTime,
  536. (newVal, oldVal) => {
  537. console.log("监听时间:", newVal);
  538. if (newVal == null) {
  539. recordPriceSearch();
  540. }
  541. }
  542. );
  543. // 改价记录 价格日期
  544. watch(
  545. () => recordSearch.setDate,
  546. (newVal, oldVal) => {
  547. console.log("监听时间:", newVal);
  548. if (newVal == null) {
  549. recordPriceSearch();
  550. }
  551. }
  552. );
  553. // 房价管理分页
  554. const getList = async () => {
  555. loading.value = true;
  556. let data = {
  557. page: currentPage.value,
  558. size: pageSize.value,
  559. houseName: searchInput.changePriceSelId, // 房型
  560. // managerId: sessionStorage.getItem("token"),
  561. };
  562. if (searchInput.createTime) {
  563. data.date = searchInput.createTime;
  564. }
  565. let res = await axios({
  566. method: "get",
  567. url: api.value + "/house-price/housePricePage",
  568. headers: {
  569. // token: sessionStorage.getItem("token"),
  570. // user_head: sessionStorage.getItem("userhead"),
  571. },
  572. params: data,
  573. });
  574. console.log(res, "房价管理");
  575. if (res.data.code == 200) {
  576. tableData.list = res.data.data.page.records;
  577. let arr = [];
  578. res.data.data.dateTime.forEach((item) => {
  579. arr.push({
  580. dateTime: item,
  581. });
  582. });
  583. tableHead.value = arr;
  584. total.value = res.data.data.page.total;
  585. loading.value = false;
  586. } else {
  587. loading.value = false;
  588. ElMessage({
  589. type: "error",
  590. showClose: true,
  591. message: res.data.message,
  592. center: true,
  593. });
  594. }
  595. };
  596. // 搜索功能 改变日期和房型改变数据
  597. const searchData = (val) => {
  598. // console.log(val);
  599. getList();
  600. };
  601. // const searchData = lodash.debounce(async () => {
  602. // getList();
  603. // }, 300);
  604. // 批量改价功能(------------------------------------)
  605. const roomClose = () => {
  606. roomCloseDialogVisible.value = true;
  607. changePrice.createTime = [[]];
  608. };
  609. // 关闭批量改价
  610. const cancelRoomClose = () => {
  611. roomCloseDialogVisible.value = false;
  612. changePriceData.list = [];
  613. changePriceSelData.value = [];
  614. };
  615. // 批量改价中表格设置价格按钮
  616. const inputPrice = (row) => {
  617. row.inputPriceShow = false;
  618. // nextTick(() => {
  619. // if (inputPriceRef.value) {
  620. // inputPriceRef.value.focus();
  621. // }
  622. // });
  623. };
  624. // 批量改价中表格设置价格按钮失去焦点
  625. const inputPriceBlur = (row) => {
  626. row.inputPriceShow = true;
  627. };
  628. // 勾选房间类型后表格添加相应的数据
  629. const changePriceSelcet = (val) => {
  630. // console.log(val);
  631. // console.log(changePriceSelData.value);
  632. changePriceData.list = [];
  633. changePriceSelData.value.forEach((item) => {
  634. changePirceRoomType.value.forEach((i) => {
  635. // console.log(item == i.id);
  636. if (item == i.id) {
  637. changePriceData.list.push(i);
  638. }
  639. });
  640. });
  641. };
  642. // 批量改价 删除时间段
  643. const delChangePriceTime = (index) => {
  644. changePrice.createTime = changePrice.createTime.filter((i, ind) => {
  645. return index != ind;
  646. });
  647. };
  648. // 批量改价 添加时间段
  649. const addChangePriceTime = () => {
  650. if (changePrice.createTime.length <= 10) {
  651. changePrice.createTime.push([]);
  652. } else {
  653. ElMessage({
  654. type: "warning",
  655. showClose: true,
  656. message: "最多可添加10个时间段",
  657. center: true,
  658. });
  659. }
  660. };
  661. // 批量改价 确定改价
  662. const notarizeRoomClose = async () => {
  663. let dateList = [];
  664. changePrice.createTime.forEach((item) => [dateList.push(item.join(","))]);
  665. // console.log(dateList);
  666. let priceList = [];
  667. changePriceData.list.forEach((item) => {
  668. console.log(item);
  669. priceList.push({
  670. managerId: item.managerId,
  671. houseId: item.id,
  672. price: item.price,
  673. createId: sessionStorage.getItem("roomId"),
  674. });
  675. });
  676. let data = {
  677. dateList: dateList,
  678. priceList: priceList,
  679. };
  680. let res = await axios({
  681. method: "post",
  682. url: api.value + "/mhotel/house/price/modifyPriceBatch.action",
  683. headers: {
  684. // token: sessionStorage.getItem("token"),
  685. // user_head: sessionStorage.getItem("userhead"),
  686. },
  687. data: data,
  688. });
  689. if (res.data.code == 200) {
  690. getList();
  691. roomCloseDialogVisible.value = false;
  692. changePriceData.list = [];
  693. changePriceSelData.value = [];
  694. ElMessage({
  695. type: "success",
  696. showClose: true,
  697. message: res.data.message,
  698. center: true,
  699. });
  700. }
  701. console.log(res, "确定改价");
  702. };
  703. // 改价记录弹窗(---------------------------------------)
  704. const recordPrice = async () => {
  705. recordDialogVisible.value = true;
  706. recordPriceData();
  707. };
  708. // 改价数据
  709. const recordPriceData = async () => {
  710. let data = {
  711. page: recordPage.value,
  712. rows: recordSize.value,
  713. managerId: sessionStorage.getItem("token"),
  714. houseId: recordSearch.roomType, // 房型id
  715. operationName: recordSearch.keyWord, // 关键字查询
  716. };
  717. if (recordSearch.operationTime) {
  718. data.operationTime = recordSearch.operationTime.join(",");
  719. }
  720. if (recordSearch.setDate) {
  721. data.setDate = recordSearch.setDate.join(",");
  722. }
  723. let res = await axios({
  724. method: "get",
  725. url: api.value + "/mhotel/house/price/queryPageHistory.action",
  726. headers: {
  727. // token: sessionStorage.getItem("token"),
  728. // user_head: sessionStorage.getItem("userhead"),
  729. },
  730. params: data,
  731. });
  732. if (res.data.code == 200) {
  733. recordData.list = res.data.data.pageList;
  734. recordTotal.value = res.data.data.total;
  735. }
  736. console.log(res, "改价记录");
  737. };
  738. // 查询数据
  739. const recordPriceSearch = () => {
  740. recordPriceData();
  741. };
  742. // 取消改价记录
  743. const cancelRecord = () => {
  744. recordDialogVisible.value = false;
  745. };
  746. // 确认添加员工
  747. // const submitAdd = async (formEl) => {
  748. // if (!formEl) return;
  749. // await formEl.validate(async (valid, fields) => {
  750. // if (valid) {
  751. // if (dialongTitle.value == "添加员工") {
  752. // let data = {
  753. // userName: ruleForm.userName,
  754. // cardNumber: ruleForm.cardNumber,
  755. // userzzId: ruleForm.userzzId,
  756. // userPhone: ruleForm.userPhone,
  757. // schoolId: ruleForm.schoolId,
  758. // workType: ruleForm.workType,
  759. // articleIds: ruleForm.articleIds,
  760. // buildIds: ruleForm.buildIds,
  761. // teamId: ruleForm.teamId,
  762. // acceptanceAssessTime: ruleForm.acceptanceTime,
  763. // maintenanceAssessTime: ruleForm.maintenanceTime,
  764. // };
  765. // let res = await axios({
  766. // method: "post",
  767. // url: api.value + "/repairUser/insertRepairUserSetting",
  768. // headers: {
  769. // token: sessionStorage.getItem("token"),
  770. // user_head: sessionStorage.getItem("userhead"),
  771. // },
  772. // data: data,
  773. // });
  774. // console.log(res, "添加员工");
  775. // if (res.data.code == 200) {
  776. // getList();
  777. // ElMessage({
  778. // type: "success",
  779. // showClose: true,
  780. // message: res.data.message,
  781. // center: true,
  782. // });
  783. // addDialogVisible.value = false;
  784. // ruleFormRef.value.resetFields();
  785. // } else {
  786. // ElMessage({
  787. // type: "error",
  788. // showClose: true,
  789. // message: res.data.message,
  790. // center: true,
  791. // });
  792. // }
  793. // } else {
  794. // let data = {
  795. // userName: ruleForm.userName,
  796. // cardNumber: ruleForm.cardNumber,
  797. // userzzId: ruleForm.userzzId,
  798. // userPhone: ruleForm.userPhone,
  799. // schoolId: ruleForm.schoolId,
  800. // workType: ruleForm.workType,
  801. // articleIds: ruleForm.articleIds,
  802. // buildIds: ruleForm.buildIds,
  803. // teamId: ruleForm.teamId,
  804. // acceptanceAssessTime: ruleForm.acceptanceTime,
  805. // maintenanceAssessTime: ruleForm.maintenanceTime,
  806. // id: ruleForm.id,
  807. // };
  808. // let res = await axios({
  809. // method: "post",
  810. // url: api.value + "/repairUser/updateRepairUserSettingById",
  811. // headers: {
  812. // token: sessionStorage.getItem("token"),
  813. // user_head: sessionStorage.getItem("userhead"),
  814. // },
  815. // data: data,
  816. // });
  817. // console.log(res, "编辑员工");
  818. // if (res.data.code == 200) {
  819. // getList();
  820. // ElMessage({
  821. // type: "success",
  822. // showClose: true,
  823. // message: res.data.message,
  824. // center: true,
  825. // });
  826. // addDialogVisible.value = false;
  827. // ruleFormRef.value.resetFields();
  828. // } else {
  829. // ElMessage({
  830. // type: "error",
  831. // showClose: true,
  832. // message: res.data.message,
  833. // center: true,
  834. // });
  835. // }
  836. // }
  837. // } else {
  838. // console.log("error submit!", fields);
  839. // }
  840. // });
  841. // };
  842. //导出功能
  843. const importExcel = lodash.debounce(async () => {
  844. let data = new FormData();
  845. data.set("managerId", sessionStorage.getItem("token"));
  846. data.set("houseId", recordSearch.roomType);
  847. data.set("operationName", recordSearch.keyWord);
  848. if (recordSearch.operationTime) {
  849. data.set("operationTime", recordSearch.operationTime.join(","));
  850. }
  851. let res = await axios({
  852. method: "post",
  853. url: api.value + "/mhotel/house/price/exportHistory.action",
  854. headers: {
  855. // token: sessionStorage.getItem("token"),
  856. },
  857. data: data,
  858. });
  859. console.log(res, "导出台账管理");
  860. if (res.data.code == 200) {
  861. // var downloadPath = res.data.downurl;
  862. // // window.open(downloadPath);
  863. // window.location.href = downloadPath;
  864. // var downloadLink = document.createElement("a");
  865. // downloadLink.style.display = "none"; // 使其隐藏
  866. // downloadLink.href = downloadPath;
  867. // downloadLink.download = "";
  868. // downloadLink.click();
  869. // document.body.appendChild(downloadLink);
  870. // document.body.removeChild(downloadLink);
  871. ElMessage({
  872. type: "success",
  873. showClose: true,
  874. message: res.data.message,
  875. center: true,
  876. });
  877. }
  878. }, 1000);
  879. // 表格斑马纹颜色修改
  880. const tableRowClassName = ({ row, rowIndex }) => {
  881. if (rowIndex % 2 === 0) {
  882. return "even";
  883. } else if (rowIndex % 2 !== 0) {
  884. return "odd";
  885. }
  886. return "";
  887. };
  888. // 表格斑马纹颜色修改
  889. const tableRowClassName2 = ({ row, rowIndex }) => {
  890. if (rowIndex % 2 === 0) {
  891. return "even2";
  892. } else if (rowIndex % 2 !== 0) {
  893. return "odd2";
  894. }
  895. return "";
  896. };
  897. // 分页
  898. const handleCurrentChange = (value) => {
  899. // console.log(value);
  900. currentPage.value = value;
  901. getList();
  902. };
  903. // 分页
  904. const handleCurrentChange2 = (value) => {
  905. // console.log(value);
  906. recordPage.value = value;
  907. recordPriceData();
  908. };
  909. onBeforeMount(async () => {
  910. api.value = store.state.user.api;
  911. const data = {
  912. managerId: sessionStorage.getItem("token"),
  913. };
  914. let res = await axios({
  915. method: "get",
  916. url: api.value + "house-price/roomType",
  917. headers: {
  918. token: sessionStorage.getItem("token"),
  919. user_head: sessionStorage.getItem("userhead"),
  920. },
  921. params: data,
  922. });
  923. console.log(res, "房型下拉框数据");
  924. houseTypeData.value=res.data.data.day
  925. // changePriceSelect.value = res.data.data;
  926. // recordRoomType.value = res.data.data;
  927. // changePirceRoomType.value = res.data.data;
  928. // searchInput.changePriceSelId = changePriceSelect.value[0].id;
  929. getList();
  930. });
  931. </script>
  932. <style scoped lang="scss">
  933. .content-box {
  934. width: calc(100% - 40px);
  935. height: calc(100% - 105px);
  936. margin: 20px auto;
  937. background-color: #fff;
  938. color: #fff;
  939. display: flex;
  940. flex-direction: column;
  941. box-shadow: 0px 3px 10px rgba(0, 97, 255, 0.2);
  942. .left {
  943. // width: calc(100wh - 40px);
  944. display: flex;
  945. align-items: center;
  946. height: 60px;
  947. margin: 0 30px;
  948. border-bottom: 1px solid #ccc;
  949. color: rgb(0, 0, 0);
  950. font-size: 18px;
  951. font-weight: 600;
  952. span {
  953. margin-right: 20px;
  954. cursor: pointer;
  955. }
  956. .is_active {
  957. color: rgba(111, 182, 184, 1);
  958. }
  959. }
  960. .tabData {
  961. width: calc(100% - 60px);
  962. height: calc(100% - 61px);
  963. margin: 0 auto;
  964. display: flex;
  965. flex-direction: column;
  966. .middle {
  967. width: 100%;
  968. margin: 0 auto;
  969. color: #000;
  970. // border-bottom: 1px solid rgb(231, 231, 231);
  971. .filter {
  972. display: flex;
  973. align-items: center;
  974. justify-content: space-between;
  975. margin-top: 10px;
  976. .filter_block {
  977. display: flex;
  978. }
  979. .search {
  980. color: #fff;
  981. }
  982. .condition {
  983. display: flex;
  984. align-items: center;
  985. margin: 10px 30px 10px 0;
  986. :deep(.el-input .el-input__inner) {
  987. font-size: 14px;
  988. }
  989. span {
  990. margin: 0 10px 0 0;
  991. }
  992. }
  993. }
  994. .gongneng {
  995. margin: 10px 0 20px 0;
  996. span {
  997. color: #fff;
  998. }
  999. }
  1000. :deep(.cont) {
  1001. width: 60%;
  1002. margin: 20px auto;
  1003. }
  1004. }
  1005. .footer {
  1006. width: 100%;
  1007. flex:1;
  1008. margin: 10px auto 0;
  1009. .el-table--fit {
  1010. height: 100%;
  1011. :deep(.el-table__header-wrapper) {
  1012. background-color: #000;
  1013. font-size: 15px;
  1014. tr {
  1015. color: #000;
  1016. }
  1017. }
  1018. :deep(.el-table__row) {
  1019. height: 50px;
  1020. font-size: 15px;
  1021. color: #000;
  1022. }
  1023. :deep(.el-table__row td) {
  1024. padding: 0;
  1025. // border: 0;
  1026. // border: 1px solid #ccc;
  1027. }
  1028. }
  1029. }
  1030. .pageSize {
  1031. display: flex;
  1032. align-items: center;
  1033. justify-content: space-between;
  1034. margin: 0 30px;
  1035. height: 60px;
  1036. span {
  1037. color: #000;
  1038. }
  1039. .el-pagination {
  1040. // width: 1600px;
  1041. :deep(.el-pagination__total) {
  1042. color: #000;
  1043. }
  1044. :deep(.el-pagination__goto) {
  1045. color: #000;
  1046. }
  1047. :deep(.el-pagination__classifier) {
  1048. color: #000;
  1049. }
  1050. :deep(.el-input__wrapper) {
  1051. border: 1px solid rgba(0, 0, 0, 1);
  1052. border-radius: 5px;
  1053. box-shadow: none;
  1054. }
  1055. :deep(.el-pager li) {
  1056. margin: 0 5px;
  1057. border: 1px solid rgba(0, 0, 0, 1);
  1058. border-radius: 5px;
  1059. background-color: transparent;
  1060. }
  1061. :deep(.el-pager li.is-active) {
  1062. // background-color: rgba(111, 182, 184, 1);
  1063. border: 1px solid rgba(0, 97, 255, 1);
  1064. color: rgba(0, 97, 255, 1);
  1065. }
  1066. :deep(.btn-prev) {
  1067. margin-right: 5px;
  1068. border: 1px solid rgba(0, 0, 0, 1);
  1069. border-radius: 5px;
  1070. background-color: transparent;
  1071. }
  1072. :deep(.btn-next) {
  1073. margin-left: 5px;
  1074. border: 1px solid rgba(0, 0, 0, 1);
  1075. border-radius: 5px;
  1076. background-color: transparent;
  1077. }
  1078. }
  1079. }
  1080. }
  1081. // 批量改价
  1082. :deep(.roomCloseDilog) {
  1083. // height: 540px;
  1084. border-radius: 11px;
  1085. .el-dialog__header {
  1086. border-radius: 11px 11px 0 0;
  1087. background: rgba(237, 241, 245, 1);
  1088. font-weight: 600;
  1089. margin: 0;
  1090. .el-dialog__headerbtn {
  1091. outline: none;
  1092. }
  1093. }
  1094. .el-dialog__body {
  1095. padding: 0;
  1096. // 上一步页面样式
  1097. .first {
  1098. ul {
  1099. width: 316px;
  1100. height: 324px;
  1101. list-style: none;
  1102. padding: 0;
  1103. margin: 0;
  1104. border: 1px solid rgba(230, 230, 230, 1);
  1105. box-sizing: border-box;
  1106. overflow: auto;
  1107. li {
  1108. display: flex;
  1109. justify-content: space-between;
  1110. padding-right: 17px;
  1111. align-items: center;
  1112. margin-top: 5px;
  1113. .el-icon-close {
  1114. cursor: pointer;
  1115. width: 10px;
  1116. height: 10px;
  1117. }
  1118. }
  1119. }
  1120. }
  1121. .options {
  1122. width: 96%;
  1123. display: flex;
  1124. flex-direction: row-reverse;
  1125. padding: 30px 0;
  1126. .queding {
  1127. margin-left: 20px;
  1128. color: #fff;
  1129. }
  1130. }
  1131. // 批量改价样式
  1132. .last {
  1133. .hint {
  1134. background-color: #e6ecfa;
  1135. border: 1px solid #053dc8;
  1136. display: flex;
  1137. align-items: center;
  1138. padding: 6px 24px;
  1139. color: #000;
  1140. img {
  1141. width: 16px;
  1142. margin: 0 3px;
  1143. }
  1144. }
  1145. .roomUl {
  1146. display: flex;
  1147. flex-direction: column;
  1148. color: #000;
  1149. // align-items: center;
  1150. .title {
  1151. width: 100px;
  1152. text-align: right;
  1153. color: #000;
  1154. margin: 20px 0;
  1155. font-weight: 600;
  1156. font-size: 16px;
  1157. }
  1158. .delRoom {
  1159. width: 80%;
  1160. margin-left: 40px;
  1161. .date {
  1162. width: 80px;
  1163. height: 100%;
  1164. transform: translateY(6px);
  1165. }
  1166. .el-input__wrapper {
  1167. max-width: 350px;
  1168. }
  1169. .el-table--fit {
  1170. .el-table__header-wrapper {
  1171. background-color: #000;
  1172. font-size: 14px;
  1173. tr {
  1174. color: #000;
  1175. }
  1176. }
  1177. .el-table__row {
  1178. height: 40px;
  1179. font-size: 14px;
  1180. color: #000;
  1181. }
  1182. .el-table__row td {
  1183. padding: 0;
  1184. border: 0;
  1185. .el-input__wrapper {
  1186. // border: 1px solid red;
  1187. max-width: 100px;
  1188. // box-shadow: none;
  1189. // background-color: transparent;
  1190. transform: translateX(46px);
  1191. .el-input__inner {
  1192. text-align: center;
  1193. }
  1194. }
  1195. }
  1196. .el-table__body .even {
  1197. background-color: #fff;
  1198. }
  1199. .el-table__body .odd {
  1200. background-color: rgba(233, 242, 242, 1);
  1201. }
  1202. }
  1203. }
  1204. }
  1205. .roomTime {
  1206. margin: 10px 0;
  1207. .delRoom {
  1208. display: flex;
  1209. align-items: flex-start;
  1210. .el-input__wrapper {
  1211. max-width: 350px;
  1212. }
  1213. // 选择日期
  1214. .addDate {
  1215. width: 450px;
  1216. .addTime {
  1217. display: flex;
  1218. align-items: center;
  1219. .imgTime {
  1220. display: flex;
  1221. align-items: center;
  1222. cursor: pointer;
  1223. img {
  1224. width: 15px;
  1225. margin-right: 5px;
  1226. }
  1227. }
  1228. span {
  1229. color: #096562;
  1230. }
  1231. .num {
  1232. font-size: 10px;
  1233. color: #a6a6a6;
  1234. margin-left: 10px;
  1235. }
  1236. }
  1237. .elDate {
  1238. max-height: 180px;
  1239. overflow: auto;
  1240. .time_li {
  1241. display: flex;
  1242. align-items: center;
  1243. margin-bottom: 10px;
  1244. img {
  1245. width: 22px;
  1246. height: 22px;
  1247. margin: 0 10px;
  1248. transform: rotate(45deg);
  1249. cursor: pointer;
  1250. }
  1251. }
  1252. }
  1253. }
  1254. }
  1255. }
  1256. .textarea {
  1257. border-bottom: 1px solid #e9eaed;
  1258. padding-bottom: 25px;
  1259. .delRoom {
  1260. width: 510px;
  1261. }
  1262. }
  1263. }
  1264. }
  1265. }
  1266. // 改价记录
  1267. :deep(.recordDilog) {
  1268. // height: 600px;
  1269. overflow: hidden;
  1270. border-radius: 11px;
  1271. .el-dialog__header {
  1272. border-radius: 11px 11px 0 0;
  1273. background: rgba(237, 241, 245, 1);
  1274. font-weight: 600;
  1275. margin: 0;
  1276. .el-dialog__headerbtn {
  1277. outline: none;
  1278. }
  1279. }
  1280. .el-dialog__body {
  1281. overflow: auto;
  1282. padding: 0px 20px 10px 20px;
  1283. .middle {
  1284. width: 96%;
  1285. margin: 0 auto;
  1286. color: #000;
  1287. // border-bottom: 1px solid rgb(231, 231, 231);
  1288. .filter {
  1289. display: flex;
  1290. flex-wrap: wrap;
  1291. align-items: center;
  1292. margin: 10px 0 0 0;
  1293. justify-content: start;
  1294. .search {
  1295. color: #fff;
  1296. }
  1297. .condition {
  1298. display: flex;
  1299. align-items: center;
  1300. margin: 10px 30px 10px 0;
  1301. :deep(.el-input .el-input__inner) {
  1302. font-size: 14px;
  1303. }
  1304. // span {
  1305. // margin: 0 10px 0 0;
  1306. // }
  1307. }
  1308. }
  1309. .gongneng {
  1310. margin: 10px 0 20px 0;
  1311. span {
  1312. color: #fff;
  1313. }
  1314. }
  1315. :deep(.cont) {
  1316. width: 60%;
  1317. margin: 20px auto;
  1318. }
  1319. :deep(.download) {
  1320. display: flex;
  1321. align-items: center;
  1322. margin: 10px;
  1323. }
  1324. :deep(.download span) {
  1325. font-size: 16px;
  1326. margin-left: 20px;
  1327. }
  1328. :deep(.cont .el-button) {
  1329. margin-left: 60px;
  1330. margin-bottom: 30px;
  1331. }
  1332. :deep(.cont .accomplish) {
  1333. width: 100%;
  1334. display: flex;
  1335. justify-content: center;
  1336. }
  1337. :deep(.cont .accomplish .el-button) {
  1338. width: 50%;
  1339. margin: 0;
  1340. }
  1341. }
  1342. .pageSize {
  1343. margin: 10px 0 10px 0;
  1344. }
  1345. .footer {
  1346. width: 96%;
  1347. // height: 402px;
  1348. margin: 10px auto 20px;
  1349. .el-table--fit {
  1350. height: 100%;
  1351. .el-table__header-wrapper {
  1352. background-color: #000;
  1353. font-size: 15px;
  1354. tr {
  1355. color: #000;
  1356. }
  1357. }
  1358. .el-table__row {
  1359. height: 50px;
  1360. font-size: 15px;
  1361. color: #000;
  1362. .orderNum {
  1363. color: rgba(111, 182, 184, 1);
  1364. cursor: pointer;
  1365. }
  1366. }
  1367. .el-table__row:nth-child(2n) {
  1368. .el-table-fixed-column--right {
  1369. background-color: rgba(240, 243, 247, 1);
  1370. }
  1371. }
  1372. .el-table__row td {
  1373. padding: 0;
  1374. border: 0;
  1375. }
  1376. .el-button--primary {
  1377. margin-left: 5px;
  1378. }
  1379. .el-table__body .even2 {
  1380. background-color: #fff;
  1381. }
  1382. .el-table__body .odd2 {
  1383. background-color: rgba(240, 243, 247, 1);
  1384. }
  1385. }
  1386. }
  1387. }
  1388. }
  1389. }
  1390. .el-input {
  1391. width: 192px;
  1392. }
  1393. </style>