orderInfo.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550
  1. <template>
  2. <view class="page" :style="{'height':(h)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="订单详情" showIcon="true" :titleStyle="titleStyle"></c-nav-bar>
  4. <view class="body" v-if="orderInfo.detailFormList[0]">
  5. <!-- 个人信息 -->
  6. <view class="uname">
  7. <text class="dtitle" style="margin-right: 50rpx;">{{orderInfo.guestName}}</text>
  8. <text class="dtitle" style="margin-right: 20rpx;">{{orderInfo.guestPhoneCopy}}</text>
  9. <image class="callphone"
  10. src="https://fsy.shengsi.gov.cn/file/20240605/20affd94bb514035b654823fefcaba2e.png"
  11. @click="callPhone(orderInfo.guestPhone)"></image>
  12. </view>
  13. <!-- 房间信息 -->
  14. <view class="room">
  15. <!-- 房间/预定信息 -->
  16. <view class="reservations">
  17. <text class="dtitle">{{orderInfo.houseBaseName}}-{{orderInfo.detailFormList[0].roomNumber}}</text>
  18. <text class="r_status"
  19. :style="{'background': scolor[orderInfo.orderStatus]}">{{getStatusText()}}</text>
  20. </view>
  21. <!-- 时间/价格 -->
  22. <view class="time-price">
  23. <text style="font-size: 30rpx; color: #777;">{{orderInfo.arriveDate}}入住 {{orderInfo.num}}晚</text>
  24. <text style="font-size: 30rpx;font-weight: bold; color: #111;">¥{{orderInfo.orderAmount}}</text>
  25. </view>
  26. <!-- 入住人数 -->
  27. <view class="house-person">
  28. <text style="font-size: 30rpx; color: #777;">入住人数量</text>
  29. <view class="right">
  30. <text
  31. style="font-size: 30rpx;font-weight: bold; color: #111; ">{{orderInfo.detailFormList[0].checkInPersonList.length}}人
  32. </text>
  33. </view>
  34. </view>
  35. <!-- 订单信息 -->
  36. <view class="r_line"></view>
  37. <view class="house-person">
  38. <text style="font-size: 30rpx; color: #777;">订单号</text>
  39. <view class="right">
  40. <text style="font-size: 30rpx; color: #111; text-align: right;">
  41. {{orderInfo.orderCode}}
  42. </text>
  43. </view>
  44. </view>
  45. <view class="house-person">
  46. <text style="font-size: 30rpx; color: #777;">创建时间</text>
  47. <view class="right">
  48. <text style="font-size: 30rpx; color: #111; text-align: right;">
  49. {{orderInfo.orderTime}}
  50. </text>
  51. </view>
  52. </view>
  53. <view class="house-person" v-if="orderInfo.orderStatus==4">
  54. <text style="font-size: 30rpx; color: #777;">取消原因</text>
  55. <view class="right">
  56. <text style="font-size: 30rpx; color: #111; text-align: right;">
  57. {{orderInfo.refundReason}}
  58. </text>
  59. </view>
  60. </view>
  61. <view class="house-person">
  62. <text style="font-size: 30rpx; color: #777;">备注</text>
  63. <view class="right">
  64. <text style="font-size: 30rpx; color: #111; text-align: right;">
  65. {{orderInfo.remarks}}
  66. </text>
  67. </view>
  68. </view>
  69. </view>
  70. <!-- 其他消费 -->
  71. <view class="room" v-if="breakFastList.length>0||otherList.length>0">
  72. <view class="reservations">
  73. <text class="dtitle">其他消费</text>
  74. </view>
  75. <view class="house-person" v-for="(item,index) in breakFastList" :key="index"
  76. v-if="breakFastList.length>0">
  77. <text style="font-size: 30rpx; color: #777;">{{item.breakfastName}} X{{item.num}}</text>
  78. <view class="right">
  79. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">
  80. ¥{{item.price*item.num}}
  81. </text>
  82. </view>
  83. </view>
  84. <view class="house-person" v-for="(item,index) in otherList" :key="index" v-if="otherList.length>0">
  85. <text style="font-size: 30rpx; color: #777;">{{item.projectName}} X{{item.num}}</text>
  86. <view class="right">
  87. <text style="font-size: 30rpx;font-weight: bold; color: #111; ">
  88. ¥{{item.defaultPrice*item.num}}
  89. </text>
  90. </view>
  91. </view>
  92. </view>
  93. <block v-if="orderInfo.repastList&&orderInfo.repastList.length>0">
  94. <view class="room" v-for="(item,index) in orderInfo.repastList" :key="index">
  95. <view class="dtitle" style="margin: 6rpx 0 40rpx;">餐饮订单详情</view>
  96. <view class="reservations">
  97. <text class="dtitle" style="color: #111;">{{item.comboName}}</text>
  98. <text class="r_status"
  99. :style="{'background': scolor[item.orderStatus]}">{{repastStr[item.orderStatus]}}</text>
  100. </view>
  101. <view class="time-price">
  102. <text style="font-size: 28rpx; color: #717171;">预约时间 {{item.repastTime}}</text>
  103. <text style="font-size: 30rpx;font-weight: bold; color: #111;">¥{{item.orderAmount}}</text>
  104. </view>
  105. <view class="r_line"></view>
  106. <view class="house-person">
  107. <text style="font-size: 30rpx; color: #777;">预约人姓名</text>
  108. <view class="right">
  109. <text style="font-size: 30rpx; color: #111; text-align: right;">
  110. {{item.guestName}}
  111. </text>
  112. </view>
  113. </view>
  114. <block v-if="item.comboType==1">
  115. <view class="house-person">
  116. <text style="font-size: 30rpx; color: #777;">成人人数</text>
  117. <view class="right">
  118. <text style="font-size: 30rpx; color: #111; text-align: right;">
  119. {{item.num}}
  120. </text>
  121. </view>
  122. </view>
  123. <view class="house-person">
  124. <text style="font-size: 30rpx; color: #777;">儿童人数</text>
  125. <view class="right">
  126. <text style="font-size: 30rpx; color: #111; text-align: right;">
  127. {{item.repastNum}}
  128. </text>
  129. </view>
  130. </view>
  131. </block>
  132. <block v-if="item.comboType==2">
  133. <view class="house-person">
  134. <text style="font-size: 30rpx; color: #777;">就餐份数</text>
  135. <view class="right">
  136. <text style="font-size: 30rpx; color: #111; text-align: right;">
  137. {{item.num}}份
  138. </text>
  139. </view>
  140. </view>
  141. </block>
  142. <view class="house-person">
  143. <text style="font-size: 30rpx; color: #777;">订单编号</text>
  144. <view class="right">
  145. <text style="font-size: 30rpx; color: #111; text-align: right;">
  146. {{item.orderCode}}
  147. </text>
  148. </view>
  149. </view>
  150. <view class="house-person">
  151. <text style="font-size: 30rpx; color: #777;">备注</text>
  152. <view class="right">
  153. <text style="font-size: 30rpx; color: #111; text-align: right;">
  154. {{item.remarks}}
  155. </text>
  156. </view>
  157. </view>
  158. </view>
  159. </block>
  160. <!-- 按钮 -->
  161. <view class="button" v-if="orderInfo.orderStatus==-1||orderInfo.orderStatus==1||orderInfo.orderStatus==2">
  162. <!-- 待确认 -->
  163. <template v-if="orderInfo.orderStatus==-1">
  164. <button class="edit" @click="cancle()">取消订单</button>
  165. <button class="goRoom" @click="show2=true">确认订单</button>
  166. </template>
  167. <!-- 已预订 -->
  168. <template v-if="orderInfo.orderStatus==1">
  169. <button class="edit" @click="edit()">编辑订单</button>
  170. <button class="goRoom" @click="checkIn(2)" v-if="showRuzhu">办理入住</button>
  171. </template>
  172. <!-- 已入住 -->
  173. <template v-if="orderInfo.orderStatus==2">
  174. <button class="edit" @click="edit()">编辑订单</button>
  175. <button class="goRoom" @click="show3=true">办理退房</button>
  176. </template>
  177. </view>
  178. </view>
  179. <!-- 取消订单 -->
  180. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  181. <view class="slot-content">
  182. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  183. <!-- <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  184. <u-cell>
  185. <view slot="title" class="title">
  186. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  187. placeholder="请输入原因" v-model="check.refundReason"></u--input>
  188. </view>
  189. </u-cell>
  190. </u-cell-group> -->
  191. </view>
  192. </u-modal>
  193. <!-- 确认订单 -->
  194. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  195. @cancel="show2=false">
  196. </u-modal>
  197. <!-- 办理退房 -->
  198. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  199. @cancel="show3=false">
  200. </u-modal>
  201. </view>
  202. </template>
  203. <script>
  204. export default {
  205. data() {
  206. return {
  207. titleStyle: {
  208. fontSize: '34rpx',
  209. fontWeight: "bold",
  210. },
  211. h: uni.getSystemInfoSync().windowHeight,
  212. mt: uni.getSystemInfoSync().statusBarHeight + 44,
  213. show: false,
  214. show2: false,
  215. show3: false,
  216. check: {
  217. initiator: 1,
  218. refundReason: "",
  219. status: -1,
  220. orderCode: "",
  221. },
  222. showRuzhu: false,
  223. orderId: '',
  224. orderInfo: {
  225. detailFormList: []
  226. },
  227. id: '',
  228. scolor: {
  229. '-2': '#FF4141',
  230. '-1': '#FEA400',
  231. '1': '#FEA400',
  232. '2': '#A9B4C1',
  233. '3': '#A9B4C1',
  234. '4': '#A9B4C1',
  235. '5': '#A9B4C1',
  236. },
  237. repastStr: {
  238. '-2': '待支付',
  239. '1': '未核销',
  240. '2': '已核销',
  241. '4': '已取消',
  242. '5': '已退款'
  243. },
  244. breakFastList: [],
  245. otherList: [],
  246. }
  247. },
  248. onLoad(opt) {
  249. if (opt.orderId) {
  250. if (opt.orderType == 201) {
  251. this.id = opt.orderId;
  252. this.getrepast()
  253. } else {
  254. this.orderId = opt.orderId;
  255. this.getOrderInfo()
  256. }
  257. }
  258. },
  259. methods: {
  260. callPhone(phoneNumber) {
  261. uni.makePhoneCall({
  262. phoneNumber
  263. })
  264. },
  265. // 获取数据
  266. getOrderInfo() {
  267. this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
  268. if (res.data.code == 0) {
  269. this.orderInfo = res.data.data;
  270. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  271. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  272. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  273. .orderInfo.guestPhone, 2)
  274. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  275. 'yyyy-MM-dd')) {
  276. this.showRuzhu = true;
  277. }
  278. }
  279. })
  280. },
  281. // 获取数据
  282. getrepast() {
  283. this.$api.get(`/merchant/hotel/repast${this.id}`).then((res) => {
  284. if (res.data.code == 0) {
  285. this.orderInfo = res.data.data;
  286. this.breakFastList = this.orderInfo.detailFormList[0].breakfastData || [];
  287. this.otherList = this.orderInfo.detailFormList[0].otherData || [];
  288. if (this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this
  289. .orderInfo.guestPhone, 2)
  290. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  291. 'yyyy-MM-dd')) {
  292. this.showRuzhu = true;
  293. }
  294. }
  295. })
  296. },
  297. // 客房状态
  298. getStatusText() {
  299. if (this.orderInfo.orderStatus === -1) {
  300. return '待确定'
  301. } else if (this.orderInfo.orderStatus === 1) {
  302. return '已预订'
  303. } else if (this.orderInfo.orderStatus === 2) {
  304. return '已入住'
  305. } else if (this.orderInfo.orderStatus === -2) {
  306. return '待支付'
  307. } else if (this.orderInfo.orderStatus === 3) {
  308. return '已退房'
  309. } else if (this.orderInfo.orderStatus === 4) {
  310. return '已取消'
  311. } else if (this.orderInfo.orderStatus === 5) {
  312. return '已退款'
  313. } else {
  314. return '状态异常'
  315. }
  316. },
  317. //添加入住人
  318. goStayCheck() {
  319. let list = JSON.stringify(this.orderInfo);
  320. uni.navigateTo({
  321. url: '/pages/house/stayCheck?orderInfo=' + list,
  322. events: {
  323. addSuccess: data => {
  324. this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
  325. }
  326. },
  327. })
  328. },
  329. // 确认订单
  330. confirmOrder() {
  331. this.$api
  332. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  333. .then((res) => {
  334. if (res.data.code !== 0) {
  335. return this.$showToast(res.data.msg);
  336. }
  337. this.show2 = false;
  338. this.$showToast('操作成功');
  339. setTimeout(() => {
  340. uni.reLaunch({
  341. url: '/pagesMy/orderList/orderList'
  342. })
  343. }, 1500)
  344. });
  345. },
  346. //取消订单
  347. cancle() {
  348. this.show = true;
  349. this.check.orderCode = this.orderInfo.orderCode;
  350. },
  351. //取消订单
  352. confirmCheck() {
  353. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  354. .then((res) => {
  355. if (res.data.code !== 0) {
  356. return this.$showToast(res.data.msg);
  357. }
  358. this.show = false;
  359. this.$showToast('操作成功');
  360. setTimeout(() => {
  361. uni.reLaunch({
  362. url: '/pagesMy/orderList/orderList'
  363. })
  364. }, 1500)
  365. });
  366. },
  367. //办理入住
  368. checkIn(orderStatus) {
  369. uni.navigateTo({
  370. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  371. })
  372. },
  373. // 编辑
  374. edit() {
  375. uni.navigateTo({
  376. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  377. })
  378. },
  379. //办理退房
  380. checkoutRoom() {
  381. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  382. .then((res) => {
  383. if (res.data.code !== 0) {
  384. return this.$showToast(res.data.msg);
  385. }
  386. this.show = false;
  387. this.$showToast('操作成功');
  388. setTimeout(() => {
  389. uni.reLaunch({
  390. url: '/pagesMy/orderList/orderList'
  391. })
  392. }, 1500)
  393. });
  394. }
  395. },
  396. computed: {
  397. isOrderPanding() {
  398. return this.orderInfo.orderStatus === 1
  399. }
  400. }
  401. }
  402. </script>
  403. <style lang="scss">
  404. .page {
  405. background: #F3F4F4;
  406. padding-bottom: 260rpx;
  407. box-sizing: border-box;
  408. overflow-y: auto;
  409. overflow-x: auto;
  410. }
  411. .body {
  412. padding-top: 20rpx;
  413. padding-left: 30rpx;
  414. padding-right: 30rpx;
  415. }
  416. .uname {
  417. width: 100%;
  418. height: 100rpx;
  419. line-height: 100rpx;
  420. background-color: #fff;
  421. padding-left: 30rpx;
  422. font-size: 30rpx;
  423. border-radius: 10rpx;
  424. box-sizing: border-box;
  425. position: relative;
  426. .callphone {
  427. width: 48rpx;
  428. height: 48rpx;
  429. position: absolute;
  430. top: 50%;
  431. margin-top: -24rpx;
  432. right: 30rpx;
  433. }
  434. }
  435. .dtitle {
  436. font-family: PingFang-SC, PingFang-SC;
  437. font-weight: bold;
  438. font-size: 36rpx;
  439. color: #333333;
  440. line-height: 40rpx;
  441. width: calc(100% - 100rpx);
  442. }
  443. .room {
  444. margin-top: 20rpx;
  445. width: 100%;
  446. background-color: #fff;
  447. margin-bottom: 20rpx;
  448. border-radius: 10rpx;
  449. padding: 30rpx;
  450. box-sizing: border-box;
  451. .r_line {
  452. width: 100%;
  453. height: 1rpx;
  454. background: #efefef;
  455. margin: 24rpx 0;
  456. }
  457. }
  458. .orderTip {
  459. padding: 30rpx;
  460. padding-top: 0;
  461. width: 690rpx;
  462. height: 514rpx;
  463. background-color: #fff;
  464. border-radius: 10rpx;
  465. }
  466. .button {
  467. position: fixed;
  468. bottom: 0;
  469. height: 96rpx;
  470. width: 100%;
  471. margin-top: 20rpx;
  472. display: flex;
  473. justify-content: space-between;
  474. border-radius: 10rpx;
  475. z-index: 9;
  476. background-color: #fff;
  477. left: 0;
  478. padding: 24rpx 0;
  479. }
  480. .goRoom {
  481. // border-radius: ;
  482. width: 330rpx;
  483. height: 96rpx;
  484. border-radius: 48rpx;
  485. font-size: 34rpx;
  486. background-color: #1372FF;
  487. color: #fff;
  488. }
  489. .edit {
  490. width: 330rpx;
  491. height: 96rpx;
  492. border-radius: 48rpx;
  493. font-size: 34rpx;
  494. background-color: #E2EDFC;
  495. color: #1372FF;
  496. }
  497. .reservations {
  498. display: flex;
  499. position: relative;
  500. .r_status {
  501. font-family: PingFang-SC, PingFang-SC;
  502. font-weight: bold;
  503. font-size: 24rpx;
  504. color: #FFFFFF;
  505. line-height: 33rpx;
  506. color: #fff;
  507. padding: 4rpx 9rpx;
  508. border-radius: 8rpx;
  509. position: absolute;
  510. right: 0;
  511. top: 50%;
  512. margin-top: -22rpx;
  513. }
  514. }
  515. .time-price {
  516. display: flex;
  517. justify-content: space-between;
  518. margin-top: 30rpx;
  519. }
  520. .house-person {
  521. display: flex;
  522. justify-content: space-between;
  523. margin-top: 30rpx;
  524. }
  525. .right {
  526. display: flex;
  527. }
  528. </style>