orderInfo.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  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 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" v-if="orderInfo.orderStatus==-1||orderInfo.orderStatus==1||orderInfo.orderStatus==2">
  71. <!-- 待确认 -->
  72. <template v-if="orderInfo.orderStatus==-1">
  73. <button class="edit" @click="cancle()">取消订单</button>
  74. <button class="goRoom" @click="show2=true">确认订单</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)" v-if="showRuzhu">办理入住</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,
  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. showRuzhu: false,
  132. orderId: '',
  133. orderInfo: {
  134. detailFormList: []
  135. }
  136. }
  137. },
  138. onLoad(opt) {
  139. if (opt.orderId) {
  140. this.orderId = opt.orderId;
  141. this.getOrderInfo()
  142. }
  143. },
  144. methods: {
  145. // 获取数据
  146. getOrderInfo() {
  147. this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
  148. if (res.data.code == 0) {
  149. this.orderInfo = res.data.data
  150. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  151. 'yyyy-MM-dd')) {
  152. this.showRuzhu = true;
  153. }
  154. }
  155. })
  156. },
  157. // 客房状态
  158. getStatusText() {
  159. if (this.orderInfo.orderStatus === -1) {
  160. return '待确定'
  161. } else if (this.orderInfo.orderStatus === 1) {
  162. return '已预订'
  163. } else if (this.orderInfo.orderStatus === 2) {
  164. return '已入住'
  165. } else if (this.orderInfo.orderStatus === -2) {
  166. return '待支付'
  167. } else if (this.orderInfo.orderStatus === 3) {
  168. return '已退房'
  169. } else if (this.orderInfo.orderStatus === 4) {
  170. return '已取消'
  171. } else if (this.orderInfo.orderStatus === 5) {
  172. return '已退款'
  173. } else {
  174. return '状态异常'
  175. }
  176. },
  177. //添加入住人
  178. goStayCheck() {
  179. let list = JSON.stringify(this.orderInfo);
  180. uni.navigateTo({
  181. url: '/pages/house/stayCheck?orderInfo=' + list,
  182. events: {
  183. addSuccess: data => {
  184. this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
  185. }
  186. },
  187. })
  188. },
  189. // 确认订单
  190. confirmOrder() {
  191. this.$api
  192. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  193. .then((res) => {
  194. if (res.data.code !== 0) {
  195. return this.$showToast(res.data.msg);
  196. }
  197. this.show2 = false;
  198. this.$showToast('操作成功');
  199. setTimeout(() => {
  200. uni.reLaunch({
  201. url: '/pagesMy/orderList/orderList'
  202. })
  203. }, 1500)
  204. });
  205. },
  206. //取消订单
  207. cancle() {
  208. this.show = true;
  209. this.check.orderCode = this.orderInfo.orderCode;
  210. },
  211. //取消订单
  212. confirmCheck() {
  213. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  214. .then((res) => {
  215. if (res.data.code !== 0) {
  216. return this.$showToast(res.data.msg);
  217. }
  218. this.show = false;
  219. this.$showToast('操作成功');
  220. setTimeout(() => {
  221. uni.reLaunch({
  222. url: '/pagesMy/orderList/orderList'
  223. })
  224. }, 1500)
  225. });
  226. },
  227. //办理入住
  228. checkIn(orderStatus) {
  229. uni.redirectTo({
  230. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  231. })
  232. },
  233. // 编辑
  234. edit() {
  235. uni.redirectTo({
  236. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  237. })
  238. },
  239. //办理退房
  240. checkoutRoom() {
  241. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  242. .then((res) => {
  243. if (res.data.code !== 0) {
  244. return this.$showToast(res.data.msg);
  245. }
  246. this.show = false;
  247. this.$showToast('操作成功');
  248. setTimeout(() => {
  249. uni.reLaunch({
  250. url: '/pagesMy/orderList/orderList'
  251. })
  252. }, 1500)
  253. });
  254. }
  255. },
  256. computed: {
  257. isOrderPanding() {
  258. return this.orderInfo.orderStatus === 1
  259. }
  260. }
  261. }
  262. </script>
  263. <style lang="scss">
  264. .page {
  265. background: #F3F4F4;
  266. padding-bottom: 260rpx;
  267. box-sizing: border-box;
  268. overflow-y: auto;
  269. overflow-x: auto;
  270. }
  271. .body {
  272. padding-top: 20rpx;
  273. padding-left: 30rpx;
  274. padding-right: 30rpx;
  275. }
  276. .uname {
  277. width: 100%;
  278. height: 100rpx;
  279. line-height: 100rpx;
  280. background-color: #fff;
  281. padding-left: 30rpx;
  282. font-size: 30rpx;
  283. border-radius: 10rpx;
  284. box-sizing: border-box;
  285. }
  286. .room {
  287. margin-top: 20rpx;
  288. width: 100%;
  289. height: 246rpx;
  290. background-color: #fff;
  291. margin-bottom: 20rpx;
  292. border-radius: 10rpx;
  293. padding: 30rpx;
  294. box-sizing: border-box;
  295. }
  296. .orderTip {
  297. padding: 30rpx;
  298. padding-top: 0;
  299. width: 690rpx;
  300. height: 514rpx;
  301. background-color: #fff;
  302. border-radius: 10rpx;
  303. }
  304. .button {
  305. position: fixed;
  306. bottom: 0;
  307. height: 96rpx;
  308. width: 100%;
  309. margin-top: 20rpx;
  310. display: flex;
  311. justify-content: space-between;
  312. border-radius: 10rpx;
  313. z-index: 9;
  314. background-color: #fff;
  315. left: 0;
  316. padding: 24rpx 0;
  317. }
  318. .goRoom {
  319. // border-radius: ;
  320. width: 330rpx;
  321. height: 96rpx;
  322. border-radius: 48rpx;
  323. font-size: 34rpx;
  324. background-color: #1372FF;
  325. color: #fff;
  326. }
  327. .edit {
  328. width: 330rpx;
  329. height: 96rpx;
  330. border-radius: 48rpx;
  331. font-size: 34rpx;
  332. background-color: #E2EDFC;
  333. color: #1372FF;
  334. }
  335. .reservations {
  336. display: flex;
  337. justify-content: space-between;
  338. }
  339. .time-price {
  340. display: flex;
  341. justify-content: space-between;
  342. margin-top: 30rpx;
  343. }
  344. .house-person {
  345. display: flex;
  346. justify-content: space-between;
  347. margin-top: 30rpx;
  348. }
  349. .right {
  350. display: flex;
  351. }
  352. </style>