index.vue 13 KB

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