index.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  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="title">
  59. <text>今日新增</text>
  60. <view @tap="toAll">
  61. <text>全部</text>
  62. <u-icon name="arrow-right" color="#999999" size="28"></u-icon>
  63. </view>
  64. </view>
  65. <block v-if="list.length>0">
  66. <view class="card" v-for="(item,index) in list" :key="index">
  67. <view class="c_top">
  68. <text>订单号:{{item.orderCode}}</text>
  69. <text v-if='item.orderStatus==-1' class="orange">待确认</text>
  70. <text v-else-if='item.orderStatus==-2' class="red">待支付</text>
  71. <text v-else-if='item.orderStatus==1' class="green">已预订</text>
  72. <text v-else-if='item.orderStatus==5' class="green">已退款</text>
  73. <text v-else-if='item.orderStatus==4' class="green">已取消</text>
  74. <text v-else-if='item.orderStatus==2' class="green">已入住</text>
  75. <text v-else-if='item.orderStatus==3' class="green">已退房</text>
  76. <text v-else :class="statusClass[item.orderStatus]">{{status[item.orderStatus]}}</text>
  77. </view>
  78. <view class="c_middle">
  79. <image :src="item.cover"></image>
  80. <view class="cm_info">
  81. <view class="cmi_title">{{item.houseBaseName}}</view>
  82. <view class="cmi_pre">{{item.guestName}}</view>
  83. <view class="cmi_pre">{{item.guestPhone}}</view>
  84. <view class="cmi_pre">{{item.date}}<span>共{{item.num}}晚</span></view>
  85. </view>
  86. <view class="cm_price">¥{{item.orderAmount?item.orderAmount.toFixed(2):''}}</view>
  87. </view>
  88. <view class="c_bottom">
  89. <view class="btn" v-if="item.orderStatus==-1" :class="item.orderStatus==-1?'btn_jj':''"
  90. @tap="cancle(item)">拒绝</view>
  91. <view class="btn" v-if="item.orderStatus==-1" @tap="toConfrimOrder(item)">确认订单</view>
  92. <view class="btn" v-if="item.orderStatus==1&&item.istoday" @tap="checkIn(2,item)">办理入住</view>
  93. <view class="btn" v-if="item.orderStatus==2" @tap="toBltf(item)">办理退房</view>
  94. <view class="btn"
  95. v-if="item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday)"
  96. :class="(item.orderStatus==3||item.orderStatus==4||(item.orderStatus==1&&!item.istoday))?'btn_xq':''"
  97. @tap="handleDetail(item)">详情</view>
  98. </view>
  99. </view>
  100. </block>
  101. <block v-else>
  102. <view class="empty">
  103. 暂无数据
  104. </view>
  105. </block>
  106. <Tabbar :tabbarIndex="0"></Tabbar>
  107. <u-picker :show="shShow" :columns="nameList" @close="shShow=false" @cancel="shShow=false" @confirm="confirm"
  108. :immediateChange="true" itemHeight="88"></u-picker>
  109. <!-- 取消订单 -->
  110. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  111. <view class="slot-content">
  112. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  113. </view>
  114. </u-modal>
  115. <!-- 确认订单 -->
  116. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  117. @cancel="show2=false">
  118. </u-modal>
  119. <!-- 办理退房 -->
  120. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  121. @cancel="show3=false">
  122. </u-modal>
  123. </view>
  124. </template>
  125. <script>
  126. export default {
  127. data() {
  128. return {
  129. name: '',
  130. shList: [],
  131. nameList: [],
  132. shShow: false,
  133. item: null,
  134. list: [],
  135. statusClass: ['', 'green', 'blue', 'grey', 'grey'],
  136. status: ['', '已预订', '已入住', '已退房', '已取消'],
  137. page: 1,
  138. limit: 10,
  139. finished: false,
  140. show: false,
  141. show2: false,
  142. show3: false,
  143. check: {
  144. initiator: 1,
  145. refundReason: "",
  146. status: -1,
  147. orderCode: "",
  148. },
  149. orderId: '',
  150. orderInfo: {}
  151. }
  152. },
  153. mounted() {
  154. this.getType();
  155. this.getDetails();
  156. this.getList();
  157. },
  158. onReachBottom() {
  159. if (this.finished) return
  160. this.getList();
  161. },
  162. onPullDownRefresh() {
  163. setTimeout(() => {
  164. this.getType();
  165. this.getDetails();
  166. this.init();
  167. uni.stopPullDownRefresh();
  168. }, 1000);
  169. },
  170. methods: {
  171. getType() {
  172. this.$api.post('/merchant/register/getMerchantStoreList').then(res => {
  173. if (res.data.code === 0) {
  174. this.shList = res.data.data;
  175. let shs = [];
  176. this.shList.forEach(d => shs.push(d.merchantName));
  177. this.nameList = [shs];
  178. let id = uni.getStorageSync('homestayId');
  179. if (!uni.getStorageSync('homestayId')) id = uni.getStorageSync('merchantId');
  180. let t = this.shList.find(d => d.merchantId == id);
  181. this.name = t ? t.merchantName : ''
  182. } else this.$showToast(res.data.msg);
  183. })
  184. },
  185. confirm(e) {
  186. console.log(e);
  187. this.name = e.value[0];
  188. this.shShow = false;
  189. let t = this.shList.find(d => d.merchantName == this.name);
  190. console.log('000', t);
  191. if (t) {
  192. if (t.merchantType == 2) { //酒店民宿
  193. uni.setStorageSync('homestayId', t.merchantId);
  194. uni.setStorageSync('merchantId', '');
  195. uni.setStorageSync('merchantType',item.merchantType);
  196. this.getDetails();
  197. this.page = 1;
  198. this.finished = false;
  199. this.list = [];
  200. this.getList();
  201. } else {
  202. this.item = null;
  203. this.list = [];
  204. uni.setStorageSync('homestayId', '');
  205. uni.setStorageSync('merchantId', t.merchantId);
  206. uni.setStorageSync('merchantType',item.merchantType);
  207. uni.navigateTo({
  208. url: '/pagesHouse/home/index?merchantType='+t.merchantType
  209. })
  210. }
  211. }
  212. },
  213. getDetails() {
  214. this.$api.get('/merchant/hotel/home/getHotelHomeInfo/' + (uni.getStorageSync('homestayId') || 0)).then(
  215. res => {
  216. if (res.data.code === 0) {
  217. this.item = res.data.data;
  218. } else this.$showToast(res.data.msg);
  219. })
  220. },
  221. getList() {
  222. this.$api.get('/merchant/hotel/order/getMerchantOrderPageList', {
  223. homestayId: (uni.getStorageSync('homestayId') || 0),
  224. limit: this.limit,
  225. page: this.page,
  226. orderStatus: '',
  227. orderTime: new Date().Format('yyyy-MM-dd')
  228. }).then(res => {
  229. if (res.data.code === 0) {
  230. this.list = [...this.list, ...res.data.data.list];
  231. this.list.forEach(l => {
  232. l.date = new Date(l.arriveDate).Format('MM/dd') + " - " + new Date(l.leaveDate)
  233. .Format('MM/dd');
  234. l.istoday = new Date().Format('yyyy-MM-dd') == new Date(l.arriveDate).Format(
  235. 'yyyy-MM-dd') ? true : false;
  236. })
  237. if (res.data.data.list.length == 0) this.finished = true;
  238. else this.page++;
  239. } else this.$showToast(res.data.msg);
  240. })
  241. },
  242. handleDetail(item) {
  243. uni.navigateTo({
  244. url: '/pages/house/orderInfo?orderId=' + item.id
  245. })
  246. },
  247. toAll() {
  248. uni.navigateTo({
  249. url: '/pagesMy/orderList/orderList'
  250. })
  251. },
  252. toTurn() {
  253. uni.navigateTo({
  254. url: '/pages/home/condition'
  255. })
  256. },
  257. toConfirm(type) {
  258. uni.navigateTo({
  259. url: '/pagesMy/orderList/orderList?Type=' + type
  260. })
  261. },
  262. cancle(item) {
  263. this.show = true;
  264. this.check.orderCode = item.orderCode;
  265. },
  266. //取消订单
  267. confirmCheck() {
  268. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  269. .then((res) => {
  270. if (res.data.code !== 0) {
  271. return this.$showToast(res.data.msg);
  272. }
  273. this.show = false;
  274. this.$showToast('操作成功');
  275. setTimeout(() => {
  276. this.init();
  277. }, 1500)
  278. });
  279. },
  280. toConfrimOrder(item) {
  281. this.orderInfo = item;
  282. this.show2 = true;
  283. },
  284. // 确认订单
  285. confirmOrder() {
  286. this.$api.get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  287. .then((res) => {
  288. if (res.data.code !== 0) {
  289. return this.$showToast(res.data.msg);
  290. }
  291. this.show2 = false;
  292. this.$showToast('操作成功');
  293. setTimeout(() => {
  294. this.init();
  295. }, 1500)
  296. });
  297. },
  298. //办理入住
  299. checkIn(orderStatus, item) {
  300. this.orderInfo = item;
  301. uni.redirectTo({
  302. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  303. })
  304. },
  305. toBltf(item) {
  306. this.orderInfo = item;
  307. this.show3 = true;
  308. },
  309. //办理退房
  310. checkoutRoom() {
  311. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  312. .then((res) => {
  313. if (res.data.code !== 0) {
  314. return this.$showToast(res.data.msg);
  315. }
  316. this.show3 = false;
  317. this.$showToast('操作成功');
  318. setTimeout(() => {
  319. this.init();
  320. }, 1500)
  321. });
  322. },
  323. init() {
  324. this.page = 1;
  325. this.finished = false;
  326. this.list = [];
  327. this.getList();
  328. }
  329. }
  330. }
  331. </script>
  332. <style scoped lang="less">
  333. .page {
  334. background: #F3F4F4;
  335. padding-bottom: 40rpx;
  336. box-sizing: border-box;
  337. .bg {
  338. width: 100%;
  339. height: 743rpx;
  340. background: url(https://i.ringzle.com/file/20240107/8bc656fc64fd4386a6b336a7dc8c86d0.png) no-repeat;
  341. background-size: 100% 100%;
  342. box-sizing: border-box;
  343. .b_money {
  344. display: flex;
  345. flex-direction: column;
  346. align-items: center;
  347. text {
  348. font-size: 56rpx;
  349. font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
  350. font-weight: bold;
  351. color: #FFFFFF;
  352. &:last-child {
  353. font-size: 32rpx;
  354. font-family: PingFang SC, PingFang SC;
  355. font-weight: 400;
  356. margin-top: 21rpx;
  357. }
  358. }
  359. }
  360. .b_items {
  361. margin-top: 20rpx;
  362. display: flex;
  363. justify-content: space-around;
  364. flex-wrap: wrap;
  365. &>view {
  366. width: 25%;
  367. margin-top: 40rpx;
  368. display: flex;
  369. flex-direction: column;
  370. align-items: center;
  371. text {
  372. font-size: 40rpx;
  373. font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
  374. font-weight: bold;
  375. color: #FFFFFF;
  376. &:last-child {
  377. font-size: 26rpx;
  378. font-family: PingFang SC, PingFang SC;
  379. font-weight: 400;
  380. margin-top: 10rpx;
  381. }
  382. }
  383. }
  384. }
  385. }
  386. .title {
  387. width: 100%;
  388. padding: 30rpx 30rpx 10rpx;
  389. box-sizing: border-box;
  390. display: flex;
  391. align-items: center;
  392. justify-content: space-between;
  393. &>text {
  394. font-size: 32rpx;
  395. font-family: PingFang SC, PingFang SC;
  396. font-weight: 800;
  397. color: #333333;
  398. }
  399. &>view {
  400. display: flex;
  401. align-items: center;
  402. text {
  403. font-size: 24rpx;
  404. font-family: PingFang SC, PingFang SC;
  405. font-weight: 400;
  406. color: #999999;
  407. margin-right: 10rpx;
  408. }
  409. }
  410. }
  411. .card {
  412. width: calc(100% - 60rpx);
  413. background: #FFFFFF;
  414. border-radius: 20rpx 20rpx 20rpx 20rpx;
  415. margin: 20rpx 30rpx 0;
  416. .c_top {
  417. width: 100%;
  418. padding: 30rpx;
  419. border-bottom: 1rpx solid #F1F1F1;
  420. box-sizing: border-box;
  421. display: flex;
  422. align-items: center;
  423. justify-content: space-between;
  424. text {
  425. font-size: 28rpx;
  426. font-family: PingFang SC, PingFang SC;
  427. font-weight: bold;
  428. color: #333333;
  429. &:last-child {
  430. font-size: 24rpx;
  431. font-family: PingFang SC, PingFang SC;
  432. font-weight: 400;
  433. }
  434. }
  435. }
  436. .c_middle {
  437. width: 100%;
  438. padding: 30rpx;
  439. border-bottom: 1rpx solid #F1F1F1;
  440. box-sizing: border-box;
  441. display: flex;
  442. position: relative;
  443. image {
  444. width: 180rpx;
  445. height: 180rpx;
  446. border-radius: 20rpx;
  447. }
  448. .cm_info {
  449. padding-left: 20rpx;
  450. .cmi_title {
  451. font-size: 28rpx;
  452. font-family: PingFang SC, PingFang SC;
  453. font-weight: bold;
  454. color: #333333;
  455. padding-bottom: 11rpx;
  456. }
  457. .cmi_pre {
  458. margin-top: 10rpx;
  459. display: flex;
  460. align-items: center;
  461. font-size: 24rpx;
  462. font-family: PingFang SC, PingFang SC;
  463. font-weight: 400;
  464. color: #777777;
  465. span {
  466. margin-left: 20rpx;
  467. }
  468. }
  469. }
  470. .cm_price {
  471. font-size: 32rpx;
  472. font-family: PingFang SC, PingFang SC;
  473. font-weight: bold;
  474. color: #F9423A;
  475. position: absolute;
  476. top: 50%;
  477. margin-top: -22.5rpx;
  478. right: 30rpx;
  479. }
  480. }
  481. .c_bottom {
  482. width: 100%;
  483. padding: 30rpx;
  484. box-sizing: border-box;
  485. display: flex;
  486. justify-content: flex-end;
  487. .btn {
  488. width: 160rpx;
  489. height: 56rpx;
  490. background: #1372FF;
  491. border-radius: 64rpx 64rpx 64rpx 64rpx;
  492. line-height: 56rpx;
  493. text-align: center;
  494. font-size: 24rpx;
  495. font-family: PingFang SC, PingFang SC;
  496. font-weight: 400;
  497. color: #FFFFFF;
  498. &.btn_xq {
  499. background: #FFFFFF;
  500. border: 1rpx solid #D1D1D1;
  501. font-size: 24rpx;
  502. color: #999999;
  503. }
  504. &.btn_jj {
  505. background: #FFFFFF;
  506. border: 1rpx solid #F9423A;
  507. font-size: 24rpx;
  508. color: #FA6760;
  509. }
  510. &:last-child {
  511. margin-left: 20rpx;
  512. }
  513. }
  514. }
  515. }
  516. .empty {
  517. width: 100%;
  518. text-align: center;
  519. padding-top: 100rpx;
  520. font-size: 34rpx;
  521. font-family: PingFang SC, PingFang SC;
  522. font-weight: 400;
  523. color: #999999;
  524. }
  525. .red {
  526. color: #F9423A !important;
  527. }
  528. .green {
  529. color: #39CE77 !important;
  530. }
  531. .blue {
  532. color: #1372FF !important;
  533. }
  534. .grey {
  535. color: #4C5F76 !important;
  536. }
  537. .orange {
  538. color: #FF9100 !important;
  539. }
  540. }
  541. /deep/.u-nav-slot {
  542. &>text {
  543. font-size: 34rpx;
  544. font-family: PingFang SC, PingFang SC;
  545. font-weight: bold;
  546. color: #FFFFFF;
  547. }
  548. .u-icon {
  549. margin: 8rpx 0 0 20rpx;
  550. }
  551. }
  552. </style>