index.vue 14 KB

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