index.vue 13 KB

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