index.vue 17 KB

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