index.vue 14 KB

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