orderInfo.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407
  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: 50rpx;">{{orderInfo.guestName}}</text>
  8. <text style="margin-right: 20rpx;">{{orderInfo.guestPhoneCopy}}</text>
  9. <image class="callphone" src="https://i.ringzle.com/file/20240605/54be8cae94374d898e4f64ca1fc2b655.png" @click="callPhone(orderInfo.guestPhone)"></image>
  10. </view>
  11. <!-- 房间信息 -->
  12. <view class="room">
  13. <!-- 房间/预定信息 -->
  14. <view class="reservations">
  15. <text
  16. style="font-size: 30rpx; color: #333333; font-weight: 700;">{{orderInfo.houseBaseName}}-{{orderInfo.detailFormList[0].roomNumber}}</text>
  17. <text style="font-size: 24rpx; color: #39CE77;" v-if="isOrderPanding">{{getStatusText()}}</text>
  18. </view>
  19. <!-- 时间/价格 -->
  20. <view class="time-price">
  21. <text style="font-size: 30rpx; color: #777;">{{orderInfo.arriveDate}}入住 {{orderInfo.num}}晚</text>
  22. <text style="font-size: 30rpx; color: #245BED;">¥{{orderInfo.orderAmount}}</text>
  23. </view>
  24. <!-- 入住人数 -->
  25. <view class="house-person">
  26. <text style="font-size: 30rpx; color: #777;">入住人</text>
  27. <view class="right">
  28. <text
  29. style="font-size: 30rpx; color: #777; ">{{orderInfo.detailFormList[0].checkInPersonList.length}}人
  30. </text>
  31. <!-- <u-icon name="arrow-right" @click.native="goStayCheck"></u-icon> -->
  32. <!-- <u-icon name="arrow-right" ></u-icon> -->
  33. </view>
  34. </view>
  35. </view>
  36. <!-- 订单信息 -->
  37. <u-cell-group :border="false"
  38. customStyle="background-color: #fff;border-radius: 16rpx;width: 690rpx;margin:0 auto;">
  39. <u-cell>
  40. <text slot="icon" style="font-size: 30rpx; margin-right: 50rpx;">订单号</text>
  41. <view slot="title" class="title">
  42. <text>{{orderInfo.orderCode}}</text>
  43. </view>
  44. </u-cell>
  45. <u-cell>
  46. <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">创建时间</text>
  47. <view slot="title" class="title">
  48. <text>{{orderInfo.orderTime}}</text>
  49. </view>
  50. </u-cell>
  51. <!-- <u-cell>
  52. <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">办理员工</text>
  53. <view slot="title" class="title">
  54. <text>何伟婷</text>
  55. </view>
  56. </u-cell> -->
  57. <u-cell v-if="orderInfo.orderStatus==4">
  58. <text slot="icon" style="font-size: 30rpx; margin-right: 20rpx;">取消原因</text>
  59. <view slot="title" class="title">
  60. <text>{{orderInfo.refundReason}}</text>
  61. </view>
  62. </u-cell>
  63. <u-cell>
  64. <text slot="icon" style="font-size: 30rpx; margin-right: 80rpx;">备注</text>
  65. <view slot="title" class="title">
  66. <text>{{orderInfo.remarks}}</text>
  67. </view>
  68. </u-cell>
  69. </u-cell-group>
  70. <!-- 按钮 -->
  71. <view class="button" v-if="orderInfo.orderStatus==-1||orderInfo.orderStatus==1||orderInfo.orderStatus==2">
  72. <!-- 待确认 -->
  73. <template v-if="orderInfo.orderStatus==-1">
  74. <button class="edit" @click="cancle()">取消订单</button>
  75. <button class="goRoom" @click="show2=true">确认订单</button>
  76. </template>
  77. <!-- 已预订 -->
  78. <template v-if="orderInfo.orderStatus==1">
  79. <button class="edit" @click="edit()">编辑订单</button>
  80. <button class="goRoom" @click="checkIn(2)" v-if="showRuzhu">办理入住</button>
  81. </template>
  82. <!-- 已入住 -->
  83. <template v-if="orderInfo.orderStatus==2">
  84. <button class="edit" @click="edit()">编辑订单</button>
  85. <button class="goRoom" @click="show3=true">办理退房</button>
  86. </template>
  87. </view>
  88. </view>
  89. <!-- 取消订单 -->
  90. <u-modal :show="show" @confirm="confirmCheck" :show-cancel-button="true" @cancel="show=false">
  91. <view class="slot-content">
  92. <input type="text" v-model="check.refundReason" placeholder="请输入原因" />
  93. <!-- <u-cell-group :border="false" customStyle="margin:0 -30rpx">
  94. <u-cell>
  95. <view slot="title" class="title">
  96. <u--input border="none" class="input" inputAlign="right" placeholderStyle="font-size:26rpx"
  97. placeholder="请输入原因" v-model="check.refundReason"></u--input>
  98. </view>
  99. </u-cell>
  100. </u-cell-group> -->
  101. </view>
  102. </u-modal>
  103. <!-- 确认订单 -->
  104. <u-modal :show="show2" content="确定该操作?" @confirm="confirmOrder" :show-cancel-button="true"
  105. @cancel="show2=false">
  106. </u-modal>
  107. <!-- 办理退房 -->
  108. <u-modal :show="show3" content="确定该操作?" @confirm="checkoutRoom" :show-cancel-button="true"
  109. @cancel="show3=false">
  110. </u-modal>
  111. </view>
  112. </template>
  113. <script>
  114. export default {
  115. data() {
  116. return {
  117. titleStyle: {
  118. fontSize: '34rpx',
  119. fontWeight: "bold",
  120. },
  121. h: uni.getSystemInfoSync().windowHeight,
  122. mt: uni.getSystemInfoSync().statusBarHeight + 44,
  123. show: false,
  124. show2: false,
  125. show3: false,
  126. check: {
  127. initiator: 1,
  128. refundReason: "",
  129. status: -1,
  130. orderCode: "",
  131. },
  132. showRuzhu: false,
  133. orderId: '',
  134. orderInfo: {
  135. detailFormList: []
  136. },
  137. id: ''
  138. }
  139. },
  140. onLoad(opt) {
  141. if (opt.orderId) {
  142. if (opt.orderType == 201) {
  143. this.id = opt.orderId;
  144. this.getrepast()
  145. } else {
  146. this.orderId = opt.orderId;
  147. this.getOrderInfo()
  148. }
  149. }
  150. },
  151. methods: {
  152. callPhone(phoneNumber){
  153. uni.makePhoneCall({
  154. phoneNumber
  155. })
  156. },
  157. // 获取数据
  158. getOrderInfo() {
  159. this.$api.get(`/merchant/hotel/order/getOrderDetail/${this.orderId}`).then((res) => {
  160. if (res.data.code == 0) {
  161. this.orderInfo = res.data.data;
  162. if(this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this.orderInfo.guestPhone,2)
  163. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  164. 'yyyy-MM-dd')) {
  165. this.showRuzhu = true;
  166. }
  167. }
  168. })
  169. },
  170. // 获取数据
  171. getrepast() {
  172. this.$api.get(`/merchant/hotel/repast${this.id}`).then((res) => {
  173. if (res.data.code == 0) {
  174. this.orderInfo = res.data.data;
  175. if(this.orderInfo.guestPhone) this.orderInfo.guestPhoneCopy = this.$aesTm.tuomin(this.orderInfo.guestPhone,2)
  176. if (new Date(this.orderInfo.arriveDate).Format('yyyy-MM-dd') == new Date().Format(
  177. 'yyyy-MM-dd')) {
  178. this.showRuzhu = true;
  179. }
  180. }
  181. })
  182. },
  183. // 客房状态
  184. getStatusText() {
  185. if (this.orderInfo.orderStatus === -1) {
  186. return '待确定'
  187. } else if (this.orderInfo.orderStatus === 1) {
  188. return '已预订'
  189. } else if (this.orderInfo.orderStatus === 2) {
  190. return '已入住'
  191. } else if (this.orderInfo.orderStatus === -2) {
  192. return '待支付'
  193. } else if (this.orderInfo.orderStatus === 3) {
  194. return '已退房'
  195. } else if (this.orderInfo.orderStatus === 4) {
  196. return '已取消'
  197. } else if (this.orderInfo.orderStatus === 5) {
  198. return '已退款'
  199. } else {
  200. return '状态异常'
  201. }
  202. },
  203. //添加入住人
  204. goStayCheck() {
  205. let list = JSON.stringify(this.orderInfo);
  206. uni.navigateTo({
  207. url: '/pages/house/stayCheck?orderInfo=' + list,
  208. events: {
  209. addSuccess: data => {
  210. this.orderInfo.detailFormList[0].checkInPersonList = data.data || [];
  211. }
  212. },
  213. })
  214. },
  215. // 确认订单
  216. confirmOrder() {
  217. this.$api
  218. .get(`/merchant/hotel/order/confirm/${this.orderInfo.id}`)
  219. .then((res) => {
  220. if (res.data.code !== 0) {
  221. return this.$showToast(res.data.msg);
  222. }
  223. this.show2 = false;
  224. this.$showToast('操作成功');
  225. setTimeout(() => {
  226. uni.reLaunch({
  227. url: '/pagesMy/orderList/orderList'
  228. })
  229. }, 1500)
  230. });
  231. },
  232. //取消订单
  233. cancle() {
  234. this.show = true;
  235. this.check.orderCode = this.orderInfo.orderCode;
  236. },
  237. //取消订单
  238. confirmCheck() {
  239. this.$api.post("/merchant/hotel/order/cancelOrder", this.check)
  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. checkIn(orderStatus) {
  255. uni.navigateTo({
  256. url: "/pages/house/createOrder?id=" + this.orderInfo.id + '&orderStatus=' + orderStatus
  257. })
  258. },
  259. // 编辑
  260. edit() {
  261. uni.navigateTo({
  262. url: "/pages/house/createOrder?id=" + this.orderInfo.id
  263. })
  264. },
  265. //办理退房
  266. checkoutRoom() {
  267. this.$api.get("/merchant/hotel/order/checkout/" + this.orderInfo.id)
  268. .then((res) => {
  269. if (res.data.code !== 0) {
  270. return this.$showToast(res.data.msg);
  271. }
  272. this.show = false;
  273. this.$showToast('操作成功');
  274. setTimeout(() => {
  275. uni.reLaunch({
  276. url: '/pagesMy/orderList/orderList'
  277. })
  278. }, 1500)
  279. });
  280. }
  281. },
  282. computed: {
  283. isOrderPanding() {
  284. return this.orderInfo.orderStatus === 1
  285. }
  286. }
  287. }
  288. </script>
  289. <style lang="scss">
  290. .page {
  291. background: #F3F4F4;
  292. padding-bottom: 260rpx;
  293. box-sizing: border-box;
  294. overflow-y: auto;
  295. overflow-x: auto;
  296. }
  297. .body {
  298. padding-top: 20rpx;
  299. padding-left: 30rpx;
  300. padding-right: 30rpx;
  301. }
  302. .uname {
  303. width: 100%;
  304. height: 100rpx;
  305. line-height: 100rpx;
  306. background-color: #fff;
  307. padding-left: 30rpx;
  308. font-size: 30rpx;
  309. border-radius: 10rpx;
  310. box-sizing: border-box;
  311. position: relative;
  312. .callphone{
  313. width: 48rpx;
  314. height: 48rpx;
  315. position: absolute;
  316. top: 50%;
  317. margin-top: -24rpx;
  318. right: 30rpx;
  319. }
  320. }
  321. .room {
  322. margin-top: 20rpx;
  323. width: 100%;
  324. height: 246rpx;
  325. background-color: #fff;
  326. margin-bottom: 20rpx;
  327. border-radius: 10rpx;
  328. padding: 30rpx;
  329. box-sizing: border-box;
  330. }
  331. .orderTip {
  332. padding: 30rpx;
  333. padding-top: 0;
  334. width: 690rpx;
  335. height: 514rpx;
  336. background-color: #fff;
  337. border-radius: 10rpx;
  338. }
  339. .button {
  340. position: fixed;
  341. bottom: 0;
  342. height: 96rpx;
  343. width: 100%;
  344. margin-top: 20rpx;
  345. display: flex;
  346. justify-content: space-between;
  347. border-radius: 10rpx;
  348. z-index: 9;
  349. background-color: #fff;
  350. left: 0;
  351. padding: 24rpx 0;
  352. }
  353. .goRoom {
  354. // border-radius: ;
  355. width: 330rpx;
  356. height: 96rpx;
  357. border-radius: 48rpx;
  358. font-size: 34rpx;
  359. background-color: #1372FF;
  360. color: #fff;
  361. }
  362. .edit {
  363. width: 330rpx;
  364. height: 96rpx;
  365. border-radius: 48rpx;
  366. font-size: 34rpx;
  367. background-color: #E2EDFC;
  368. color: #1372FF;
  369. }
  370. .reservations {
  371. display: flex;
  372. justify-content: space-between;
  373. }
  374. .time-price {
  375. display: flex;
  376. justify-content: space-between;
  377. margin-top: 30rpx;
  378. }
  379. .house-person {
  380. display: flex;
  381. justify-content: space-between;
  382. margin-top: 30rpx;
  383. }
  384. .right {
  385. display: flex;
  386. }
  387. </style>