index.vue 14 KB

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