orderInfo.vue 10.0 KB

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