orderInfo.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. <template>
  2. <view class="page" :style="{'height':(h-th)+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="订单详情" :showIcon="false" :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.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.checkInNums}}人 </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>
  55. <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">取消原因</text>
  56. <view slot="title" class="title">
  57. <text>-</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>-</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">确认订单</button>
  73. </template>
  74. <!-- 已预订 -->
  75. <template v-if="orderInfo.orderStatus==1">
  76. <button class="edit" @click="edit()">编辑订单</button>
  77. <button class="goRoom" @click="checkIn()">办理入住</button>
  78. </template>
  79. <!-- 已入住 -->
  80. <template v-if="orderInfo.orderStatus==2">
  81. <button class="edit" @click="edit()">编辑订单</button>
  82. <button class="goRoom" @click="checkIn()">办理退房</button>
  83. </template>
  84. </view>
  85. </view>
  86. <!-- 取消订单 -->
  87. <u-modal v-model="show" @confirm="confirmCheck">
  88. <view class="slot-content">
  89. <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  90. <u-cell>
  91. <text slot="icon" class="label">原因:</text>
  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 v-model="show2" content="确定该操作?" @confirm="confirmOrder">
  102. </u-modal>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. show: false,
  110. show2: false,
  111. check: {
  112. initiator: 1,
  113. refundReason: "",
  114. status: -1,
  115. orderCode: "",
  116. },
  117. orderId: '',
  118. orderInfo: {}
  119. }
  120. },
  121. onLoad(opt) {
  122. if (opt.orderId) {
  123. this.orderId = opt.orderId;
  124. this.getOrderInfo()
  125. }
  126. },
  127. methods: {
  128. // 获取数据
  129. getOrderInfo() {
  130. this.$api.get(`/merchant/hotel/order/getMerchantOrderInfo/${this.orderId}`, {
  131. orderId: this.orderId
  132. }).then((res) => {
  133. if (res.data.code == 0) {
  134. this.orderInfo = res.data.data
  135. }
  136. })
  137. },
  138. // 客房状态
  139. getStatusText() {
  140. if (this.orderInfo.orderStatus === -1) {
  141. return '待确定'
  142. } else if (this.orderInfo.orderStatus === 1) {
  143. return '已预订'
  144. } else if (this.orderInfo.orderStatus === 2) {
  145. return '已入住'
  146. } else if (this.orderInfo.orderStatus === 3) {
  147. return '已退房'
  148. } else if (this.orderInfo.orderStatus === 4) {
  149. return '已取消'
  150. } else {
  151. return '状态异常'
  152. }
  153. },
  154. goStayCheck(id) {
  155. uni.navigateTo({
  156. url: `/pages/house/stayCheck?id=${this.orderId}`
  157. })
  158. },
  159. // 确认订单
  160. confirmOrder() {
  161. this.$api
  162. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  163. .then((res) => {
  164. if (res.data.code !== 0) {
  165. return this.$showToast(res.data.msg);
  166. }
  167. this.show2 = false;
  168. this.$showToast('操作成功');
  169. setTimeout(() => {
  170. uni.reLaunch({
  171. url: '/pagesMy/orderList/orderList'
  172. })
  173. }, 1500)
  174. });
  175. },
  176. //取消订单
  177. cancle() {
  178. this.show = true;
  179. this.check.orderCode = this.orderInfo.orderCode;
  180. },
  181. //取消订单
  182. confirmCheck() {
  183. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  184. .then((res) => {
  185. if (res.data.code !== 0) {
  186. return this.$showToast(res.data.msg);
  187. }
  188. this.show = false;
  189. this.$showToast('操作成功');
  190. setTimeout(() => {
  191. uni.reLaunch({
  192. url: '/pagesMy/orderList/orderList'
  193. })
  194. }, 1500)
  195. });
  196. },
  197. //办理入住
  198. checkIn(orderStatus) {
  199. uni.redirectTo({
  200. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  201. })
  202. },
  203. // 编辑
  204. edit() {
  205. uni.redirectTo({
  206. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  207. })
  208. }
  209. },
  210. computed: {
  211. isOrderPanding() {
  212. return this.orderInfo.orderStatus === 1
  213. }
  214. }
  215. }
  216. </script>
  217. <style lang="scss">
  218. .page {
  219. background: #F3F4F4;
  220. padding-bottom: 260rpx;
  221. box-sizing: border-box;
  222. overflow-y: auto;
  223. overflow-x: auto;
  224. }
  225. .body {
  226. padding-top: 20rpx;
  227. padding-left: 30rpx;
  228. padding-right: 30rpx;
  229. }
  230. .uname {
  231. width: 665rpx;
  232. height: 100rpx;
  233. line-height: 100rpx;
  234. background-color: #fff;
  235. padding-left: 30rpx;
  236. font-size: 30rpx;
  237. border-radius: 10rpx;
  238. }
  239. .room {
  240. margin-top: 20rpx;
  241. width: 92%;
  242. height: 246rpx;
  243. background-color: #fff;
  244. margin-bottom: 20rpx;
  245. border-radius: 10rpx;
  246. padding: 30rpx;
  247. }
  248. .orderTip {
  249. padding: 30rpx;
  250. padding-top: 0;
  251. width: 690rpx;
  252. height: 514rpx;
  253. background-color: #fff;
  254. border-radius: 10rpx;
  255. }
  256. .button {
  257. position: fixed;
  258. bottom: 120rpx;
  259. height: 96rpx;
  260. width: 690rpx;
  261. // background-color: teal;
  262. margin-top: 20rpx;
  263. display: flex;
  264. justify-content: space-between;
  265. border-radius: 10rpx;
  266. z-index: 9;
  267. }
  268. .goRoom {
  269. // border-radius: ;
  270. width: 330rpx;
  271. height: 96rpx;
  272. border-radius: 48rpx;
  273. font-size: 34rpx;
  274. background-color: #1372FF;
  275. color: #fff;
  276. }
  277. .edit {
  278. width: 330rpx;
  279. height: 96rpx;
  280. border-radius: 48rpx;
  281. font-size: 34rpx;
  282. background-color: #E2EDFC;
  283. color: #1372FF;
  284. }
  285. .reservations {
  286. display: flex;
  287. justify-content: space-between;
  288. }
  289. .time-price {
  290. display: flex;
  291. justify-content: space-between;
  292. margin-top: 30rpx;
  293. }
  294. .house-person {
  295. display: flex;
  296. justify-content: space-between;
  297. margin-top: 30rpx;
  298. }
  299. .right {
  300. display: flex;
  301. }
  302. </style>