orderInfo.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  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">
  5. <!-- 个人信息 -->
  6. <view class="uname">
  7. <text style="margin-right: 20rpx;">{{orderInfo.guestName}}</text>
  8. <text>{{orderInfo.guestPhone}}</text>
  9. </view>
  10. <!-- 房间信息 -->
  11. <view class="room">
  12. <!-- 房间/预定信息 -->
  13. <view class="reservations">
  14. <text
  15. style="font-size: 30rpx; color: #333333; font-weight: 700;">{{orderInfo.houseBaseName}}-{{orderInfo.detailFormList[0].roomNumber}}</text>
  16. <text style="font-size: 24rpx; color: #39CE77;" v-if="isOrderPanding">{{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; color: #245BED;">{{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; color: #777; ">{{orderInfo.detailFormList[0].checkInPersonList.length}}
  29. </text>
  30. <u-icon name="arrow-right" @click.native="goStayCheck"></u-icon>
  31. <!-- <u-icon name="arrow-right" ></u-icon> -->
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 订单信息 -->
  36. <u-cell-group :border="false"
  37. customStyle="background-color: #fff;border-radius: 16rpx;width: 690rpx;margin:0 auto;">
  38. <u-cell>
  39. <text slot="icon" style="font-size: 30rpx; margin-right: 50rpx;">订单号</text>
  40. <view slot="title" class="title">
  41. <text>{{orderInfo.orderCode}}</text>
  42. </view>
  43. </u-cell>
  44. <u-cell>
  45. <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">创建时间</text>
  46. <view slot="title" class="title">
  47. <text>{{orderInfo.orderTime}}</text>
  48. </view>
  49. </u-cell>
  50. <!-- <u-cell>
  51. <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">办理员工</text>
  52. <view slot="title" class="title">
  53. <text>何伟婷</text>
  54. </view>
  55. </u-cell> -->
  56. <u-cell v-if="orderInfo.orderStatus==4">
  57. <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">取消原因</text>
  58. <view slot="title" class="title">
  59. <text>{{orderInfo.refundReason}}</text>
  60. </view>
  61. </u-cell>
  62. <u-cell>
  63. <text slot="icon" style="font-size: 30rpx; margin-right: 80rpx;">备注</text>
  64. <view slot="title" class="title">
  65. <text>{{orderInfo.remarks}}</text>
  66. </view>
  67. </u-cell>
  68. </u-cell-group>
  69. <!-- 按钮 -->
  70. <view class="button">
  71. <!-- 待确认 -->
  72. <template v-if="orderInfo.orderStatus==-1">
  73. <button class="edit" @click="cancle()">取消订单</button>
  74. <button class="goRoom" @click="show2=true" v-if="orderInfo.status==1">确认订单</button>
  75. </template>
  76. <!-- 已预订 -->
  77. <template v-if="orderInfo.orderStatus==1">
  78. <button class="edit" @click="edit()">编辑订单</button>
  79. <button class="goRoom" @click="checkIn(2)">办理入住</button>
  80. </template>
  81. <!-- 已入住 -->
  82. <template v-if="orderInfo.orderStatus==2">
  83. <button class="edit" @click="edit()">编辑订单</button>
  84. <button class="goRoom" @click="show3=true">办理退房</button>
  85. </template>
  86. </view>
  87. </view>
  88. <!-- 取消订单 -->
  89. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  90. <view class="slot-content">
  91. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  92. <!-- <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  93. <u-cell>
  94. <view slot="title" class="title">
  95. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  96. placeholder="请输入原因" v-model="check.refundReason"></u--input>
  97. </view>
  98. </u-cell>
  99. </u-cell-group> -->
  100. </view>
  101. </u-modal>
  102. <!-- 确认订单 -->
  103. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  104. @cancel="show2=false">
  105. </u-modal>
  106. <!-- 办理退房 -->
  107. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  108. @cancel="show3=false">
  109. </u-modal>
  110. </view>
  111. </template>
  112. <script>
  113. export default {
  114. data() {
  115. return {
  116. titleStyle: {
  117. fontSize: '34rpx',
  118. fontWeight: "bold",
  119. },
  120. h: uni.getSystemInfoSync().windowHeight - 87,
  121. mt: uni.getSystemInfoSync().statusBarHeight + 44,
  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. onLoad(opt) {
  136. if (opt.orderId) {
  137. this.orderId = opt.orderId;
  138. this.getOrderInfo()
  139. }
  140. },
  141. methods: {
  142. // 获取数据
  143. getOrderInfo() {
  144. this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
  145. if (res.data.code == 0) {
  146. this.orderInfo = res.data.data
  147. }
  148. })
  149. },
  150. // 客房状态
  151. getStatusText() {
  152. if (this.orderInfo.orderStatus === -1) {
  153. return '待确定'
  154. } else if (this.orderInfo.orderStatus === 1) {
  155. return '已预订'
  156. } else if (this.orderInfo.orderStatus === 2) {
  157. return '已入住'
  158. } else if (this.orderInfo.orderStatus === -2) {
  159. return '待支付'
  160. } else if (this.orderInfo.orderStatus === 3) {
  161. return '已退房'
  162. } else if (this.orderInfo.orderStatus === 4) {
  163. return '已取消'
  164. } else if (this.orderInfo.orderStatus === 5) {
  165. return '已退款'
  166. } else {
  167. return '状态异常'
  168. }
  169. },
  170. //添加入住人
  171. goStayCheck() {
  172. let list = JSON.stringify(this.orderInfo);
  173. uni.navigateTo({
  174. url: '/pages/house/stayCheck?orderInfo=' + list,
  175. events: {
  176. addSuccess: data => {
  177. this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
  178. console.log(this.orderInfo.detailFormList[0].checkInPersonList)
  179. }
  180. },
  181. })
  182. },
  183. // 确认订单
  184. confirmOrder() {
  185. this.$api
  186. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  187. .then((res) => {
  188. if (res.data.code !== 0) {
  189. return this.$showToast(res.data.msg);
  190. }
  191. this.show2 = false;
  192. this.$showToast('操作成功');
  193. setTimeout(() => {
  194. uni.reLaunch({
  195. url: '/pagesMy/orderList/orderList'
  196. })
  197. }, 1500)
  198. });
  199. },
  200. //取消订单
  201. cancle() {
  202. this.show = true;
  203. this.check.orderCode = this.orderInfo.orderCode;
  204. },
  205. //取消订单
  206. confirmCheck() {
  207. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  208. .then((res) => {
  209. if (res.data.code !== 0) {
  210. return this.$showToast(res.data.msg);
  211. }
  212. this.show = false;
  213. this.$showToast('操作成功');
  214. setTimeout(() => {
  215. uni.reLaunch({
  216. url: '/pagesMy/orderList/orderList'
  217. })
  218. }, 1500)
  219. });
  220. },
  221. //办理入住
  222. checkIn(orderStatus) {
  223. uni.redirectTo({
  224. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  225. })
  226. },
  227. // 编辑
  228. edit() {
  229. uni.redirectTo({
  230. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  231. })
  232. },
  233. //办理退房
  234. checkoutRoom() {
  235. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  236. .then((res) => {
  237. if (res.data.code !== 0) {
  238. return this.$showToast(res.data.msg);
  239. }
  240. this.show = false;
  241. this.$showToast('操作成功');
  242. setTimeout(() => {
  243. uni.reLaunch({
  244. url: '/pagesMy/orderList/orderList'
  245. })
  246. }, 1500)
  247. });
  248. }
  249. },
  250. computed: {
  251. isOrderPanding() {
  252. return this.orderInfo.orderStatus === 1
  253. }
  254. }
  255. }
  256. </script>
  257. <style lang="scss">
  258. .page {
  259. background: #F3F4F4;
  260. padding-bottom: 260rpx;
  261. box-sizing: border-box;
  262. overflow-y: auto;
  263. overflow-x: auto;
  264. }
  265. .body {
  266. padding-top: 20rpx;
  267. padding-left: 30rpx;
  268. padding-right: 30rpx;
  269. }
  270. .uname {
  271. width: 100%;
  272. height: 100rpx;
  273. line-height: 100rpx;
  274. background-color: #fff;
  275. padding-left: 30rpx;
  276. font-size: 30rpx;
  277. border-radius: 10rpx;
  278. box-sizing: border-box;
  279. }
  280. .room {
  281. margin-top: 20rpx;
  282. width: 100%;
  283. height: 246rpx;
  284. background-color: #fff;
  285. margin-bottom: 20rpx;
  286. border-radius: 10rpx;
  287. padding: 30rpx;
  288. box-sizing: border-box;
  289. }
  290. .orderTip {
  291. padding: 30rpx;
  292. padding-top: 0;
  293. width: 690rpx;
  294. height: 514rpx;
  295. background-color: #fff;
  296. border-radius: 10rpx;
  297. }
  298. .button {
  299. position: fixed;
  300. bottom: 40rpx;
  301. height: 96rpx;
  302. width: 690rpx;
  303. // background-color: teal;
  304. margin-top: 20rpx;
  305. display: flex;
  306. justify-content: space-between;
  307. border-radius: 10rpx;
  308. z-index: 9;
  309. }
  310. .goRoom {
  311. // border-radius: ;
  312. width: 330rpx;
  313. height: 96rpx;
  314. border-radius: 48rpx;
  315. font-size: 34rpx;
  316. background-color: #1372FF;
  317. color: #fff;
  318. }
  319. .edit {
  320. width: 330rpx;
  321. height: 96rpx;
  322. border-radius: 48rpx;
  323. font-size: 34rpx;
  324. background-color: #E2EDFC;
  325. color: #1372FF;
  326. }
  327. .reservations {
  328. display: flex;
  329. justify-content: space-between;
  330. }
  331. .time-price {
  332. display: flex;
  333. justify-content: space-between;
  334. margin-top: 30rpx;
  335. }
  336. .house-person {
  337. display: flex;
  338. justify-content: space-between;
  339. margin-top: 30rpx;
  340. }
  341. .right {
  342. display: flex;
  343. }
  344. </style>