orderInfo.vue 9.5 KB

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