index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702
  1. <template>
  2. <view class="page" :style="{'min-height':(h-th)+'px'}">
  3. <u-navbar bgColor="transparent">
  4. <view class="u-nav-slot" slot="left" style="display: flex;" @tap="shShow=true">
  5. <text>{{name}}</text>
  6. <u-icon name="arrow-down" size="28" :bold="true" color="#fff"></u-icon>
  7. </view>
  8. </u-navbar>
  9. <view class="bg" :style="{'padding-top':(mt+30)+'px'}">
  10. <view class="b_money">
  11. <text v-if="item">{{item.todayOrderAmount.toFixed(2)}}</text>
  12. <text v-else>0.00</text>
  13. <text>今日订单金额</text>
  14. </view>
  15. <view class="b_items">
  16. <view @tap="toTurn">
  17. <text v-if="item">{{item.stayedInRooms||0}}</text>
  18. <text v-else>0</text>
  19. <text>已入住 </text>
  20. </view>
  21. <view>
  22. <text v-if="item">{{item.yestOrders||0}}</text>
  23. <text v-else>0</text>
  24. <text>昨日订单</text>
  25. </view>
  26. <view @tap="toConfirm(0)">
  27. <text v-if="item">{{item.undeterminedOrders||0}}</text>
  28. <text v-else>0</text>
  29. <text>待确认</text>
  30. </view>
  31. <view @tap="toConfirm(2)">
  32. <text v-if="item">{{item.pendingOrders||0}}</text>
  33. <text v-else>0</text>
  34. <text>待处理</text>
  35. </view>
  36. <view @tap="toTurn">
  37. <text v-if="item">{{item.toCheckinRooms||0}}</text>
  38. <text v-else>0</text>
  39. <text>待入住</text>
  40. </view>
  41. <view @tap="toTurn">
  42. <text v-if="item">{{item.yestSaleRooms||0}}</text>
  43. <text v-else>0</text>
  44. <text>昨日售出</text>
  45. </view>
  46. <view @tap="toTurn">
  47. <text v-if="item">{{item.yestVacantRooms||0}}</text>
  48. <text v-else>0</text>
  49. <text>昨日空房</text>
  50. </view>
  51. <view>
  52. <text v-if="item">{{item.yestCheckinRatio||0}}%</text>
  53. <text v-else>0%</text>
  54. <text>入住率</text>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="menus">
  59. <view @click="SweepIt()">
  60. <view class="image">
  61. <image :src="icons[0]"></image>
  62. </view>
  63. <text>扫码核销</text>
  64. </view>
  65. <view @click="toHref('/pages/HotelMerchandise/index')">
  66. <view class="image">
  67. <image :src="icons[1]"></image>
  68. </view>
  69. <text>商品管理</text>
  70. </view>
  71. <view @click="toHref('/pages/HotelMerchandise/record')">
  72. <view class="image">
  73. <image :src="icons[2]"></image>
  74. </view>
  75. <text>核销记录</text>
  76. </view>
  77. <view @click="toHref('/pages/my/roomType')">
  78. <view class="image">
  79. <image :src="icons[3]"></image>
  80. </view>
  81. <text>房型管理</text>
  82. </view>
  83. </view>
  84. <view class="title">
  85. <text>今日新增</text>
  86. <view @tap="toAll">
  87. <text>全部</text>
  88. <u-icon name="arrow-right" color="#999999" size="28"></u-icon>
  89. </view>
  90. </view>
  91. <block v-if="list.length>0">
  92. <view class="card" v-for="(item,index) in list" :key="index">
  93. <view class="c_top">
  94. <text>订单号:{{item.orderCode}}</text>
  95. <text v-if='item.orderStatus==-1' class="orange">待确认</text>
  96. <text v-else-if='item.orderStatus==-2' class="red">待支付</text>
  97. <text v-else-if='item.orderStatus==1' class="green">已预订</text>
  98. <text v-else-if='item.orderStatus==5' class="green">已退款</text>
  99. <text v-else-if='item.orderStatus==4' class="green">已取消</text>
  100. <text v-else-if='item.orderStatus==2' class="green">{{item.orderType==2?'已入住':'已核销'}}</text>
  101. <text v-else-if='item.orderStatus==3' class="green">已退房</text>
  102. <text v-else :class="statusClass[item.orderStatus]">{{status[item.orderStatus]}}</text>
  103. </view>
  104. <view class="c_middle">
  105. <image :src="item.cover"></image>
  106. <view class="cm_info">
  107. <view class="cmi_title">{{item.orderType=='201'?item.comboName:item.houseBaseName}}</view>
  108. <view class="cmi_pre">{{item.guestName}}</view>
  109. <view class="cmi_pre">{{item.guestPhone}}</view>
  110. <view class="cmi_pre" v-if="item.orderType=='201'">
  111. {{item.repastTime}}
  112. </view>
  113. <view class="cmi_pre" v-else>{{item.date}}<span>共{{item.num}}晚</span></view>
  114. </view>
  115. <view class="cm_price">¥{{item.orderAmount?item.orderAmount.toFixed(2):''}}</view>
  116. </view>
  117. <view class="c_bottom">
  118. <view class="btn" v-if="item.orderStatus==-1" :class="item.orderStatus==-1?'btn_jj':''"
  119. @tap="cancle(item)">拒绝</view>
  120. <view class="btn" v-if="item.orderStatus==-1" @tap="toConfrimOrder(item)">确认订单</view>
  121. <view class="btn" v-if="item.orderStatus==1&&item.istoday" @tap="checkIn(2,item)">办理入住</view>
  122. <view class="btn" v-if="item.orderStatus==2&&item.orderType==2" @tap="toBltf(item)">办理退房</view>
  123. <view class="btn"
  124. v-if="item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday)"
  125. :class="(item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday))?'btn_xq':''"
  126. @tap="handleDetail(item)">详情</view>
  127. </view>
  128. </view>
  129. </block>
  130. <block v-else>
  131. <view class="empty">
  132. 暂无数据
  133. </view>
  134. </block>
  135. <Tabbar :tabbarIndex="0"></Tabbar>
  136. <u-picker :show="shShow" :columns="nameList" @close="shShow=false" @cancel="shShow=false" @confirm="confirm"
  137. :immediateChange="true" itemHeight="88"></u-picker>
  138. <!-- 取消订单 -->
  139. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  140. <view class="slot-content">
  141. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  142. </view>
  143. </u-modal>
  144. <!-- 确认订单 -->
  145. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  146. @cancel="show2=false">
  147. </u-modal>
  148. <!-- 办理退房 -->
  149. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  150. @cancel="show3=false">
  151. </u-modal>
  152. </view>
  153. </template>
  154. <script>
  155. export default {
  156. data() {
  157. return {
  158. name: '',
  159. shList: [],
  160. nameList: [],
  161. shShow: false,
  162. item: null,
  163. list: [],
  164. statusClass: ['', 'green', 'blue', 'grey', 'grey'],
  165. status: ['', '已预订', '已入住', '已退房', '已取消'],
  166. icons: ['https://i.ringzle.com/file/20240316/11f5fb8c696445bfa3b4f711480f01ae.png',
  167. 'https://i.ringzle.com/file/20240316/67b6030b8e5b4270bb6bec4336966dbf.png',
  168. 'https://i.ringzle.com/file/20240316/f53883f0f0ba463aa63476d9a4370c3c.png',
  169. 'https://i.ringzle.com/file/20240316/fb22921cc3654a33998b50bf825eca18.png'
  170. ],
  171. page: 1,
  172. limit: 10,
  173. finished: false,
  174. show: false,
  175. show2: false,
  176. show3: false,
  177. check: {
  178. initiator: 1,
  179. refundReason: "",
  180. status: -1,
  181. orderCode: "",
  182. },
  183. orderId: '',
  184. orderInfo: {}
  185. }
  186. },
  187. mounted() {
  188. this.getType();
  189. this.getDetails();
  190. this.getList();
  191. },
  192. onReachBottom() {
  193. if (this.finished) return
  194. this.getList();
  195. },
  196. onPullDownRefresh() {
  197. setTimeout(() => {
  198. this.getType();
  199. this.getDetails();
  200. this.init();
  201. uni.stopPullDownRefresh();
  202. }, 1000);
  203. },
  204. methods: {
  205. // 跳转
  206. toHref(url) {
  207. uni.redirectTo({
  208. url: url
  209. })
  210. },
  211. // 扫码
  212. SweepIt() {
  213. // this.$showToast('正在开发中...');
  214. uni.scanCode({
  215. onlyFromCamera: true,
  216. success: (res) => {
  217. console.log('扫描二维码成功,结果:' + res.result);
  218. let orderId = res.result
  219. uni.navigateTo({
  220. url: '/pages/house/orderDetails?orderId=' + orderId
  221. })
  222. // this.$api.get('/merchant/hotel/repast/writeOffOrder/' + res.result)
  223. // .then(res => {
  224. // console.log('0000', res);
  225. // if (res.data.code == 0) {
  226. // uni.setStorageSync('list', res.data.data);
  227. // } else {
  228. // this.$showToast(res.data.msg)
  229. // }
  230. // })
  231. },
  232. error: (res) => {
  233. console.log('扫描二维码出现错误')
  234. }
  235. })
  236. },
  237. getType() {
  238. this.$api.post('/merchant/register/getMerchantStoreList').then(res => {
  239. if (res.data.code === 0) {
  240. this.shList = res.data.data;
  241. let shs = [];
  242. this.shList.forEach(d => shs.push(d.merchantName));
  243. this.nameList = [shs];
  244. let id = uni.getStorageSync('homestayId');
  245. if (!uni.getStorageSync('homestayId')) id = uni.getStorageSync('merchantId');
  246. let t = this.shList.find(d => d.merchantId == id);
  247. this.name = t ? t.merchantName : ''
  248. } else this.$showToast(res.data.msg);
  249. })
  250. },
  251. confirm(e) {
  252. console.log(e);
  253. this.name = e.value[0];
  254. this.shShow = false;
  255. let t = this.shList.find(d => d.merchantName == this.name);
  256. console.log('000', t);
  257. if (t) {
  258. uni.setStorageSync('merchantType', t.merchantType);
  259. if (t.merchantType == 2) { //酒店民宿
  260. uni.setStorageSync('homestayId', t.merchantId);
  261. uni.setStorageSync('merchantId', '');
  262. this.getDetails();
  263. this.page = 1;
  264. this.finished = false;
  265. this.list = [];
  266. this.getList();
  267. } else {
  268. this.item = null;
  269. this.list = [];
  270. uni.setStorageSync('homestayId', '');
  271. uni.setStorageSync('merchantId', t.merchantId);
  272. uni.navigateTo({
  273. url: '/pagesHouse/home/index?merchantType=' + t.merchantType
  274. })
  275. }
  276. }
  277. },
  278. getDetails() {
  279. this.$api.get('/merchant/hotel/home/getHotelHomeInfo/' + (uni.getStorageSync('homestayId') || 0)).then(
  280. res => {
  281. if (res.data.code === 0) {
  282. this.item = res.data.data;
  283. } else this.$showToast(res.data.msg);
  284. })
  285. },
  286. getList() {
  287. this.$api.get('/merchant/hotel/order/getMerchantOrderPageList', {
  288. homestayId: (uni.getStorageSync('homestayId') || 0),
  289. limit: this.limit,
  290. page: this.page,
  291. orderStatus: '',
  292. orderTime: new Date().Format('yyyy-MM-dd')
  293. }).then(res => {
  294. if (res.data.code === 0) {
  295. this.list = [...this.list, ...res.data.data.list];
  296. this.list.forEach(l => {
  297. l.date = new Date(l.arriveDate).Format('MM/dd') + " - " + new Date(l.leaveDate)
  298. .Format('MM/dd');
  299. l.istoday = new Date().Format('yyyy-MM-dd') == new Date(l.arriveDate).Format(
  300. 'yyyy-MM-dd') ? true : false;
  301. })
  302. if (res.data.data.list.length == 0) this.finished = true;
  303. else this.page++;
  304. } else this.$showToast(res.data.msg);
  305. })
  306. },
  307. handleDetail(item) {
  308. if (item.orderType == 2) {
  309. uni.navigateTo({
  310. url: '/pages/house/orderInfo?orderId=' + item.id
  311. })
  312. } else {
  313. uni.navigateTo({
  314. url: '/pages/house/orderDetails?orderId=' + item.id
  315. })
  316. }
  317. },
  318. toAll() {
  319. uni.navigateTo({
  320. url: '/pagesMy/orderList/orderList'
  321. })
  322. },
  323. toTurn() {
  324. uni.navigateTo({
  325. url: '/pages/home/condition'
  326. })
  327. },
  328. toConfirm(type) {
  329. uni.navigateTo({
  330. url: '/pagesMy/orderList/orderList?Type=' + type
  331. })
  332. },
  333. cancle(item) {
  334. this.show = true;
  335. this.check.orderCode = item.orderCode;
  336. },
  337. //取消订单
  338. confirmCheck() {
  339. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  340. .then((res) => {
  341. if (res.data.code !== 0) {
  342. return this.$showToast(res.data.msg);
  343. }
  344. this.show = false;
  345. this.$showToast('操作成功');
  346. setTimeout(() => {
  347. this.init();
  348. }, 1500)
  349. });
  350. },
  351. toConfrimOrder(item) {
  352. this.orderInfo = item;
  353. this.show2 = true;
  354. },
  355. // 确认订单
  356. confirmOrder() {
  357. this.$api.get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  358. .then((res) => {
  359. if (res.data.code !== 0) {
  360. return this.$showToast(res.data.msg);
  361. }
  362. this.show2 = false;
  363. this.$showToast('操作成功');
  364. setTimeout(() => {
  365. this.init();
  366. }, 1500)
  367. });
  368. },
  369. //办理入住
  370. checkIn(orderStatus, item) {
  371. this.orderInfo = item;
  372. uni.redirectTo({
  373. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  374. })
  375. },
  376. toBltf(item) {
  377. this.orderInfo = item;
  378. this.show3 = true;
  379. },
  380. //办理退房
  381. checkoutRoom() {
  382. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  383. .then((res) => {
  384. if (res.data.code !== 0) {
  385. return this.$showToast(res.data.msg);
  386. }
  387. this.show3 = false;
  388. this.$showToast('操作成功');
  389. setTimeout(() => {
  390. this.init();
  391. }, 1500)
  392. });
  393. },
  394. init() {
  395. this.page = 1;
  396. this.finished = false;
  397. this.list = [];
  398. this.getList();
  399. }
  400. }
  401. }
  402. </script>
  403. <style scoped lang="less">
  404. .menus {
  405. position: relative;
  406. top: -30rpx;
  407. display: flex;
  408. justify-content: space-around;
  409. height: 184rpx;
  410. border-radius: 24rpx;
  411. background-color: #fff;
  412. color: #333;
  413. align-items: center;
  414. &>view {
  415. .image {
  416. width: 50rpx;
  417. height: 50rpx;
  418. display: block;
  419. margin: 0 auto 22rpx;
  420. }
  421. image {
  422. width: 100%;
  423. height: 100%;
  424. }
  425. text {
  426. font-size: 26rpx;
  427. }
  428. }
  429. }
  430. .page {
  431. background: #F3F4F4;
  432. padding-bottom: 40rpx;
  433. box-sizing: border-box;
  434. .bg {
  435. width: 100%;
  436. height: 743rpx;
  437. background: url(https://i.ringzle.com/file/20240107/8bc656fc64fd4386a6b336a7dc8c86d0.png) no-repeat;
  438. background-size: 100% 100%;
  439. box-sizing: border-box;
  440. .b_money {
  441. display: flex;
  442. flex-direction: column;
  443. align-items: center;
  444. text {
  445. font-size: 56rpx;
  446. font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
  447. font-weight: bold;
  448. color: #FFFFFF;
  449. &:last-child {
  450. font-size: 32rpx;
  451. font-family: PingFang SC, PingFang SC;
  452. font-weight: 400;
  453. margin-top: 21rpx;
  454. }
  455. }
  456. }
  457. .b_items {
  458. margin-top: 20rpx;
  459. display: flex;
  460. justify-content: space-around;
  461. flex-wrap: wrap;
  462. &>view {
  463. width: 25%;
  464. margin-top: 40rpx;
  465. display: flex;
  466. flex-direction: column;
  467. align-items: center;
  468. text {
  469. font-size: 40rpx;
  470. font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
  471. font-weight: bold;
  472. color: #FFFFFF;
  473. &:last-child {
  474. font-size: 26rpx;
  475. font-family: PingFang SC, PingFang SC;
  476. font-weight: 400;
  477. margin-top: 10rpx;
  478. }
  479. }
  480. }
  481. }
  482. }
  483. .title {
  484. width: 100%;
  485. padding: 10rpx 30rpx 10rpx;
  486. box-sizing: border-box;
  487. display: flex;
  488. align-items: center;
  489. justify-content: space-between;
  490. &>text {
  491. font-size: 32rpx;
  492. font-family: PingFang SC, PingFang SC;
  493. font-weight: 800;
  494. color: #333333;
  495. }
  496. &>view {
  497. display: flex;
  498. align-items: center;
  499. text {
  500. font-size: 24rpx;
  501. font-family: PingFang SC, PingFang SC;
  502. font-weight: 400;
  503. color: #999999;
  504. margin-right: 10rpx;
  505. }
  506. }
  507. }
  508. .card {
  509. width: calc(100% - 60rpx);
  510. background: #FFFFFF;
  511. border-radius: 20rpx 20rpx 20rpx 20rpx;
  512. margin: 20rpx 30rpx 0;
  513. .c_top {
  514. width: 100%;
  515. padding: 30rpx;
  516. border-bottom: 1rpx solid #F1F1F1;
  517. box-sizing: border-box;
  518. display: flex;
  519. align-items: center;
  520. justify-content: space-between;
  521. text {
  522. font-size: 28rpx;
  523. font-family: PingFang SC, PingFang SC;
  524. font-weight: bold;
  525. color: #333333;
  526. &:last-child {
  527. font-size: 24rpx;
  528. font-family: PingFang SC, PingFang SC;
  529. font-weight: 400;
  530. }
  531. }
  532. }
  533. .c_middle {
  534. width: 100%;
  535. padding: 30rpx;
  536. border-bottom: 1rpx solid #F1F1F1;
  537. box-sizing: border-box;
  538. display: flex;
  539. position: relative;
  540. image {
  541. width: 180rpx;
  542. height: 180rpx;
  543. border-radius: 20rpx;
  544. }
  545. .cm_info {
  546. padding-left: 20rpx;
  547. .cmi_title {
  548. font-size: 28rpx;
  549. font-family: PingFang SC, PingFang SC;
  550. font-weight: bold;
  551. color: #333333;
  552. padding-bottom: 11rpx;
  553. }
  554. .cmi_pre {
  555. margin-top: 10rpx;
  556. display: flex;
  557. align-items: center;
  558. font-size: 24rpx;
  559. font-family: PingFang SC, PingFang SC;
  560. font-weight: 400;
  561. color: #777777;
  562. span {
  563. margin-left: 20rpx;
  564. }
  565. }
  566. }
  567. .cm_price {
  568. font-size: 32rpx;
  569. font-family: PingFang SC, PingFang SC;
  570. font-weight: bold;
  571. color: #F9423A;
  572. position: absolute;
  573. top: 50%;
  574. margin-top: -22.5rpx;
  575. right: 30rpx;
  576. }
  577. }
  578. .c_bottom {
  579. width: 100%;
  580. padding: 30rpx;
  581. box-sizing: border-box;
  582. display: flex;
  583. justify-content: flex-end;
  584. .btn {
  585. width: 160rpx;
  586. height: 56rpx;
  587. background: #1372FF;
  588. border-radius: 64rpx 64rpx 64rpx 64rpx;
  589. line-height: 56rpx;
  590. text-align: center;
  591. font-size: 24rpx;
  592. font-family: PingFang SC, PingFang SC;
  593. font-weight: 400;
  594. color: #FFFFFF;
  595. &.btn_xq {
  596. background: #FFFFFF;
  597. border: 1rpx solid #D1D1D1;
  598. font-size: 24rpx;
  599. color: #999999;
  600. }
  601. &.btn_jj {
  602. background: #FFFFFF;
  603. border: 1rpx solid #F9423A;
  604. font-size: 24rpx;
  605. color: #FA6760;
  606. }
  607. &:last-child {
  608. margin-left: 20rpx;
  609. }
  610. }
  611. }
  612. }
  613. .empty {
  614. width: 100%;
  615. text-align: center;
  616. padding-top: 100rpx;
  617. font-size: 34rpx;
  618. font-family: PingFang SC, PingFang SC;
  619. font-weight: 400;
  620. color: #999999;
  621. }
  622. .red {
  623. color: #F9423A !important;
  624. }
  625. .green {
  626. color: #39CE77 !important;
  627. }
  628. .blue {
  629. color: #1372FF !important;
  630. }
  631. .grey {
  632. color: #4C5F76 !important;
  633. }
  634. .orange {
  635. color: #FF9100 !important;
  636. }
  637. }
  638. /deep/.u-nav-slot {
  639. &>text {
  640. font-size: 34rpx;
  641. font-family: PingFang SC, PingFang SC;
  642. font-weight: bold;
  643. color: #FFFFFF;
  644. }
  645. .u-icon {
  646. margin: 8rpx 0 0 20rpx;
  647. }
  648. }
  649. </style>