orderInfo.vue 8.9 KB

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