index.vue 13 KB

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