index.vue 14 KB

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