orderInfo.vue 15 KB

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