index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694
  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()">
  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">已入住</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" @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. this.$api.get('/merchant/merchantFisherman/home/getDetails?writeOffCode=' + res.result)
  219. .then(res => {
  220. if (res.data.code == 0) {
  221. this.value = ''
  222. uni.setStorageSync('list', res.data.data);
  223. uni.navigateTo({
  224. url: '/pagesHouse/Verification/details'
  225. })
  226. } else {
  227. this.value = ''
  228. this.$showToast(res.data.msg)
  229. }
  230. })
  231. },
  232. error: (res) => {
  233. console.log('扫描二维码出现错误')
  234. }
  235. })
  236. },
  237. getType() {
  238. this.$api.post('/merchant/register/getMerchantStoreList').then(res => {
  239. if (res.data.code === 0) {
  240. this.shList = res.data.data;
  241. let shs = [];
  242. this.shList.forEach(d => shs.push(d.merchantName));
  243. this.nameList = [shs];
  244. let id = uni.getStorageSync('homestayId');
  245. if (!uni.getStorageSync('homestayId')) id = uni.getStorageSync('merchantId');
  246. let t = this.shList.find(d => d.merchantId == id);
  247. this.name = t ? t.merchantName : ''
  248. } else this.$showToast(res.data.msg);
  249. })
  250. },
  251. confirm(e) {
  252. console.log(e);
  253. this.name = e.value[0];
  254. this.shShow = false;
  255. let t = this.shList.find(d => d.merchantName == this.name);
  256. console.log('000', t);
  257. if (t) {
  258. uni.setStorageSync('merchantType', t.merchantType);
  259. if (t.merchantType == 2) { //酒店民宿
  260. uni.setStorageSync('homestayId', t.merchantId);
  261. uni.setStorageSync('merchantId', '');
  262. this.getDetails();
  263. this.page = 1;
  264. this.finished = false;
  265. this.list = [];
  266. this.getList();
  267. } else {
  268. this.item = null;
  269. this.list = [];
  270. uni.setStorageSync('homestayId', '');
  271. uni.setStorageSync('merchantId', t.merchantId);
  272. uni.navigateTo({
  273. url: '/pagesHouse/home/index?merchantType=' + t.merchantType
  274. })
  275. }
  276. }
  277. },
  278. getDetails() {
  279. this.$api.get('/merchant/hotel/home/getHotelHomeInfo/' + (uni.getStorageSync('homestayId') || 0)).then(
  280. res => {
  281. if (res.data.code === 0) {
  282. this.item = res.data.data;
  283. } else this.$showToast(res.data.msg);
  284. })
  285. },
  286. getList() {
  287. this.$api.get('/merchant/hotel/order/getMerchantOrderPageList', {
  288. homestayId: (uni.getStorageSync('homestayId') || 0),
  289. limit: this.limit,
  290. page: this.page,
  291. orderStatus: '',
  292. orderTime: new Date().Format('yyyy-MM-dd')
  293. }).then(res => {
  294. if (res.data.code === 0) {
  295. this.list = [...this.list, ...res.data.data.list];
  296. this.list.forEach(l => {
  297. l.date = new Date(l.arriveDate).Format('MM/dd') + " - " + new Date(l.leaveDate)
  298. .Format('MM/dd');
  299. l.istoday = new Date().Format('yyyy-MM-dd') == new Date(l.arriveDate).Format(
  300. 'yyyy-MM-dd') ? true : false;
  301. })
  302. if (res.data.data.list.length == 0) this.finished = true;
  303. else this.page++;
  304. } else this.$showToast(res.data.msg);
  305. })
  306. },
  307. handleDetail(item) {
  308. uni.navigateTo({
  309. url: '/pages/house/orderInfo?orderId=' + item.id
  310. })
  311. },
  312. toAll() {
  313. uni.navigateTo({
  314. url: '/pagesMy/orderList/orderList'
  315. })
  316. },
  317. toTurn() {
  318. uni.navigateTo({
  319. url: '/pages/home/condition'
  320. })
  321. },
  322. toConfirm(type) {
  323. uni.navigateTo({
  324. url: '/pagesMy/orderList/orderList?Type=' + type
  325. })
  326. },
  327. cancle(item) {
  328. this.show = true;
  329. this.check.orderCode = item.orderCode;
  330. },
  331. //取消订单
  332. confirmCheck() {
  333. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  334. .then((res) => {
  335. if (res.data.code !== 0) {
  336. return this.$showToast(res.data.msg);
  337. }
  338. this.show = false;
  339. this.$showToast('操作成功');
  340. setTimeout(() => {
  341. this.init();
  342. }, 1500)
  343. });
  344. },
  345. toConfrimOrder(item) {
  346. this.orderInfo = item;
  347. this.show2 = true;
  348. },
  349. // 确认订单
  350. confirmOrder() {
  351. this.$api.get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  352. .then((res) => {
  353. if (res.data.code !== 0) {
  354. return this.$showToast(res.data.msg);
  355. }
  356. this.show2 = false;
  357. this.$showToast('操作成功');
  358. setTimeout(() => {
  359. this.init();
  360. }, 1500)
  361. });
  362. },
  363. //办理入住
  364. checkIn(orderStatus, item) {
  365. this.orderInfo = item;
  366. uni.redirectTo({
  367. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  368. })
  369. },
  370. toBltf(item) {
  371. this.orderInfo = item;
  372. this.show3 = true;
  373. },
  374. //办理退房
  375. checkoutRoom() {
  376. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  377. .then((res) => {
  378. if (res.data.code !== 0) {
  379. return this.$showToast(res.data.msg);
  380. }
  381. this.show3 = false;
  382. this.$showToast('操作成功');
  383. setTimeout(() => {
  384. this.init();
  385. }, 1500)
  386. });
  387. },
  388. init() {
  389. this.page = 1;
  390. this.finished = false;
  391. this.list = [];
  392. this.getList();
  393. }
  394. }
  395. }
  396. </script>
  397. <style scoped lang="less">
  398. .menus {
  399. position: relative;
  400. top: -30rpx;
  401. display: flex;
  402. justify-content: space-around;
  403. height: 184rpx;
  404. border-radius: 24rpx;
  405. background-color: #fff;
  406. color: #333;
  407. align-items: center;
  408. &>view {
  409. .image {
  410. width: 50rpx;
  411. height: 50rpx;
  412. display: block;
  413. margin: 0 auto 22rpx;
  414. }
  415. image {
  416. width: 100%;
  417. height: 100%;
  418. }
  419. text {
  420. font-size: 26rpx;
  421. }
  422. }
  423. }
  424. .page {
  425. background: #F3F4F4;
  426. padding-bottom: 40rpx;
  427. box-sizing: border-box;
  428. .bg {
  429. width: 100%;
  430. height: 743rpx;
  431. background: url(https://i.ringzle.com/file/20240107/8bc656fc64fd4386a6b336a7dc8c86d0.png) no-repeat;
  432. background-size: 100% 100%;
  433. box-sizing: border-box;
  434. .b_money {
  435. display: flex;
  436. flex-direction: column;
  437. align-items: center;
  438. text {
  439. font-size: 56rpx;
  440. font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
  441. font-weight: bold;
  442. color: #FFFFFF;
  443. &:last-child {
  444. font-size: 32rpx;
  445. font-family: PingFang SC, PingFang SC;
  446. font-weight: 400;
  447. margin-top: 21rpx;
  448. }
  449. }
  450. }
  451. .b_items {
  452. margin-top: 20rpx;
  453. display: flex;
  454. justify-content: space-around;
  455. flex-wrap: wrap;
  456. &>view {
  457. width: 25%;
  458. margin-top: 40rpx;
  459. display: flex;
  460. flex-direction: column;
  461. align-items: center;
  462. text {
  463. font-size: 40rpx;
  464. font-family: Alibaba PuHuiTi, Alibaba PuHuiTi;
  465. font-weight: bold;
  466. color: #FFFFFF;
  467. &:last-child {
  468. font-size: 26rpx;
  469. font-family: PingFang SC, PingFang SC;
  470. font-weight: 400;
  471. margin-top: 10rpx;
  472. }
  473. }
  474. }
  475. }
  476. }
  477. .title {
  478. width: 100%;
  479. padding: 10rpx 30rpx 10rpx;
  480. box-sizing: border-box;
  481. display: flex;
  482. align-items: center;
  483. justify-content: space-between;
  484. &>text {
  485. font-size: 32rpx;
  486. font-family: PingFang SC, PingFang SC;
  487. font-weight: 800;
  488. color: #333333;
  489. }
  490. &>view {
  491. display: flex;
  492. align-items: center;
  493. text {
  494. font-size: 24rpx;
  495. font-family: PingFang SC, PingFang SC;
  496. font-weight: 400;
  497. color: #999999;
  498. margin-right: 10rpx;
  499. }
  500. }
  501. }
  502. .card {
  503. width: calc(100% - 60rpx);
  504. background: #FFFFFF;
  505. border-radius: 20rpx 20rpx 20rpx 20rpx;
  506. margin: 20rpx 30rpx 0;
  507. .c_top {
  508. width: 100%;
  509. padding: 30rpx;
  510. border-bottom: 1rpx solid #F1F1F1;
  511. box-sizing: border-box;
  512. display: flex;
  513. align-items: center;
  514. justify-content: space-between;
  515. text {
  516. font-size: 28rpx;
  517. font-family: PingFang SC, PingFang SC;
  518. font-weight: bold;
  519. color: #333333;
  520. &:last-child {
  521. font-size: 24rpx;
  522. font-family: PingFang SC, PingFang SC;
  523. font-weight: 400;
  524. }
  525. }
  526. }
  527. .c_middle {
  528. width: 100%;
  529. padding: 30rpx;
  530. border-bottom: 1rpx solid #F1F1F1;
  531. box-sizing: border-box;
  532. display: flex;
  533. position: relative;
  534. image {
  535. width: 180rpx;
  536. height: 180rpx;
  537. border-radius: 20rpx;
  538. }
  539. .cm_info {
  540. padding-left: 20rpx;
  541. .cmi_title {
  542. font-size: 28rpx;
  543. font-family: PingFang SC, PingFang SC;
  544. font-weight: bold;
  545. color: #333333;
  546. padding-bottom: 11rpx;
  547. }
  548. .cmi_pre {
  549. margin-top: 10rpx;
  550. display: flex;
  551. align-items: center;
  552. font-size: 24rpx;
  553. font-family: PingFang SC, PingFang SC;
  554. font-weight: 400;
  555. color: #777777;
  556. span {
  557. margin-left: 20rpx;
  558. }
  559. }
  560. }
  561. .cm_price {
  562. font-size: 32rpx;
  563. font-family: PingFang SC, PingFang SC;
  564. font-weight: bold;
  565. color: #F9423A;
  566. position: absolute;
  567. top: 50%;
  568. margin-top: -22.5rpx;
  569. right: 30rpx;
  570. }
  571. }
  572. .c_bottom {
  573. width: 100%;
  574. padding: 30rpx;
  575. box-sizing: border-box;
  576. display: flex;
  577. justify-content: flex-end;
  578. .btn {
  579. width: 160rpx;
  580. height: 56rpx;
  581. background: #1372FF;
  582. border-radius: 64rpx 64rpx 64rpx 64rpx;
  583. line-height: 56rpx;
  584. text-align: center;
  585. font-size: 24rpx;
  586. font-family: PingFang SC, PingFang SC;
  587. font-weight: 400;
  588. color: #FFFFFF;
  589. &.btn_xq {
  590. background: #FFFFFF;
  591. border: 1rpx solid #D1D1D1;
  592. font-size: 24rpx;
  593. color: #999999;
  594. }
  595. &.btn_jj {
  596. background: #FFFFFF;
  597. border: 1rpx solid #F9423A;
  598. font-size: 24rpx;
  599. color: #FA6760;
  600. }
  601. &:last-child {
  602. margin-left: 20rpx;
  603. }
  604. }
  605. }
  606. }
  607. .empty {
  608. width: 100%;
  609. text-align: center;
  610. padding-top: 100rpx;
  611. font-size: 34rpx;
  612. font-family: PingFang SC, PingFang SC;
  613. font-weight: 400;
  614. color: #999999;
  615. }
  616. .red {
  617. color: #F9423A !important;
  618. }
  619. .green {
  620. color: #39CE77 !important;
  621. }
  622. .blue {
  623. color: #1372FF !important;
  624. }
  625. .grey {
  626. color: #4C5F76 !important;
  627. }
  628. .orange {
  629. color: #FF9100 !important;
  630. }
  631. }
  632. /deep/.u-nav-slot {
  633. &>text {
  634. font-size: 34rpx;
  635. font-family: PingFang SC, PingFang SC;
  636. font-weight: bold;
  637. color: #FFFFFF;
  638. }
  639. .u-icon {
  640. margin: 8rpx 0 0 20rpx;
  641. }
  642. }
  643. </style>