orderList.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  1. <template>
  2. <view class="pages">
  3. <!-- <TopTabs :list="tabList" @changeTab="changeTab">
  4. </TopTabs> -->
  5. <view class="tb">
  6. <view class="tabs">
  7. <view v-for="(item,index) in tabList" :key="index" @tap="changeTab1(index)">
  8. <text :class="index==current?'active':''">{{item.name}}</text>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="mainContain">
  13. <view class="card" v-for="item,index in dataList" :key="index">
  14. <view class="header">
  15. <span style="font-weight: 700;">订单号:{{item.orderCode}}</span>
  16. <text v-if='item.orderStatus==-1&&item.status==1' class="orange">待确认</text>
  17. <text v-else-if='item.status==0&&item.orderStatus==-1' class="red">待支付</text>
  18. <text v-else-if='item.orderStatus==1&&item.status==1' class="green">已预订</text>
  19. <text v-else :class="statusClass[item.orderStatus]">{{status[item.orderStatus]}}</text>
  20. </view>
  21. <view class="mainContent">
  22. <image class="image" :src="item.cover" mode="aspectFill"></image>
  23. <view class="middle">
  24. <span class="title">{{item.houseBaseName}}-{{item.roomNumber}}</span>
  25. <span class='info'>
  26. <span>{{item.guestName}}</span>
  27. <span>{{item.guestPhone}}</span>
  28. <span>{{item.arriveDate}}到{{item.leaveDate}} </span>
  29. </span>
  30. </view>
  31. <view class="price">
  32. ¥{{item.orderAmount}}
  33. </view>
  34. </view>
  35. <!-- <view class="bottom" v-if="item.orderStatus==-1">
  36. <view class="refuse">
  37. 拒绝
  38. </view>
  39. <view class="btn">
  40. 确认订单
  41. </view>
  42. </view>
  43. <view class="bottom" v-else-if="item.orderStatus==1">
  44. <view class="btn">
  45. 办理入住
  46. </view>
  47. </view>
  48. <view class="bottom" v-else-if="item.orderStatus==2">
  49. <view class="btn">
  50. 办理退房
  51. </view>
  52. </view> -->
  53. <view class="bottom" @click="handleDetail(item)">
  54. <view class="detail">
  55. 详情
  56. </view>
  57. </view>
  58. <!-- <view class="bottom" @click="handleDetail(item)" v-else-if="item.orderStatus==4">
  59. <view class="detail">
  60. 详情
  61. </view>
  62. </view> -->
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import TopTabs from '../../components/TopTabs/topTabs.vue';
  69. export default {
  70. components: {
  71. TopTabs,
  72. },
  73. data() {
  74. return {
  75. current: 0,
  76. mysearch: '',
  77. dataList: [],
  78. limit: 10,
  79. page: 1,
  80. homestayId: this.$store.state.moduleHouse.homestayId,
  81. statusClass: [
  82. '',
  83. 'green',
  84. 'blue',
  85. 'grey',
  86. 'grey',
  87. ],
  88. status: [
  89. '',
  90. '已预订',
  91. '已入住',
  92. '已退房',
  93. '已取消',
  94. ],
  95. // mt: uni.getSystemInfoSync().statusBarHeight + 44,
  96. tabList: [{
  97. name: '全部'
  98. },
  99. {
  100. name: '待确认'
  101. },
  102. {
  103. name: '待支付'
  104. },
  105. {
  106. name: '已预订'
  107. },
  108. {
  109. name: '已取消'
  110. },
  111. ],
  112. }
  113. },
  114. onLoad(option) {
  115. if (option.Type) {
  116. const type = parseInt(option.Type) + 1
  117. this.changeTab1(type)
  118. } else {
  119. this.getOrderList()
  120. }
  121. },
  122. methods: {
  123. changeTab1(index) {
  124. this.current = index;
  125. this.changeTab(index)
  126. },
  127. getOrderList(orderStatus) {
  128. this.$api.get('/merchant/hotel/order/getMerchantOrderPageList', {
  129. homestayId: '1711268640588517378',
  130. limit: this.limit,
  131. page: this.page,
  132. orderStatus: orderStatus ? orderStatus : ''
  133. }).then((res => {
  134. if (res.data.code == 0) {
  135. this.dataList = res.data.data.list
  136. this.dataList.forEach((i, index) => {
  137. this.dataList[index].arriveDate = i.arriveDate.slice(0, 10)
  138. this.dataList[index].leaveDate = i.leaveDate.slice(0, 10)
  139. })
  140. } else {
  141. uni.showToast({
  142. title: res.data.msg,
  143. icon: 'none'
  144. })
  145. }
  146. }))
  147. },
  148. getOrderByStatusList() {
  149. this.$api.get('/merchant/hotel/order/getMerchantOrderPageList', {
  150. homestayId: this.homestayId,
  151. limit: this.limit,
  152. page: this.page,
  153. status: 0
  154. }).then((res => {
  155. if (res.data.code == 0) {
  156. this.dataList = res.data.data.list
  157. this.dataList.forEach((i, index) => {
  158. this.dataList[index].arriveDate = i.arriveDate.slice(0, 10)
  159. this.dataList[index].leaveDate = i.leaveDate.slice(0, 10)
  160. })
  161. } else {
  162. uni.showToast({
  163. title: res.data.msg,
  164. icon: 'none'
  165. })
  166. }
  167. }))
  168. },
  169. handleDetail(item) {
  170. uni.navigateTo({
  171. url: '/pages/house/orderInfo?orderId='+item.id
  172. })
  173. },
  174. changeTab(index) {
  175. console.log(index, 'index------');
  176. this.tabIdx = index;
  177. switch (index) {
  178. case 0:
  179. this.getOrderList()
  180. break
  181. case 1:
  182. this.getOrderList(-1)
  183. break
  184. case 2:
  185. this.getOrderByStatusList()
  186. break
  187. case 3:
  188. this.getOrderList(1)
  189. break
  190. case 4:
  191. this.getOrderList(4)
  192. break
  193. }
  194. },
  195. }
  196. }
  197. </script>
  198. <style lang="scss" scoped>
  199. .pages {
  200. background: #F9FAFC;
  201. .tb {
  202. width: 100%;
  203. top: 0;
  204. left: 0;
  205. z-index: 999;
  206. .searchBoxParent {
  207. width: 100%;
  208. background: #fff;
  209. padding: 20rpx 24rpx 6rpx;
  210. box-sizing: border-box;
  211. .searchBox {
  212. width: 100%;
  213. background-color: #fff;
  214. }
  215. }
  216. .tabs {
  217. background: #fff;
  218. padding: 26rpx 0;
  219. display: flex;
  220. align-items: center;
  221. width: 100%;
  222. &>view {
  223. width: 25%;
  224. font-size: 28rpx;
  225. font-family: PingFangSC-Regular, PingFang SC;
  226. font-weight: 400;
  227. color: black;
  228. line-height: 40rpx;
  229. position: relative;
  230. text-align: center;
  231. }
  232. .active {
  233. font-size: 32rpx;
  234. font-family: PingFang-SC-Bold, PingFang-SC;
  235. font-weight: bold;
  236. color: black;
  237. line-height: 45rpx;
  238. }
  239. .active::after {
  240. position: absolute;
  241. content: '';
  242. width: 50rpx;
  243. height: 8rpx;
  244. background: #1372FF;
  245. bottom: -26rpx;
  246. left: 60%;
  247. margin-left: -42rpx;
  248. }
  249. }
  250. }
  251. .green {}
  252. .mainContain {
  253. display: flex;
  254. flex-direction: column;
  255. padding: 0 20rpx;
  256. .card {
  257. background: #fff;
  258. border-radius: 16rpx;
  259. margin: 20rpx 0;
  260. padding: 20rpx;
  261. .header {
  262. display: flex;
  263. justify-content: space-between;
  264. border-bottom: 1px #f3f3f3 solid;
  265. padding: 20rpx;
  266. .red {
  267. color: indianred;
  268. }
  269. .green {
  270. color: #39CE77;
  271. }
  272. .blue {
  273. color: #1372FF;
  274. }
  275. .grey {
  276. color: #4C5F76;
  277. }
  278. .orange {
  279. color: #FF9100;
  280. }
  281. }
  282. .mainContent {
  283. border-bottom: 1px #f3f3f3 solid;
  284. display: flex;
  285. padding: 20rpx 0;
  286. justify-content: space-evenly;
  287. .image {
  288. background-repeat: no-repeat;
  289. background-size: cover;
  290. width: 198rpx;
  291. height: 180rpx;
  292. border-radius: 16rpx;
  293. }
  294. .middle {
  295. color: #777777;
  296. display: flex;
  297. flex-direction: column;
  298. justify-content: space-between;
  299. margin-left: 25rpx;
  300. .title {
  301. font-weight: 700;
  302. font-size: 32rpx;
  303. color: black;
  304. }
  305. .info {
  306. color: #777777;
  307. display: flex;
  308. flex-direction: column;
  309. &>span {
  310. margin-top: 10rpx;
  311. }
  312. }
  313. }
  314. .price {
  315. color: red;
  316. text-align: center;
  317. height: 100%;
  318. align-items: center;
  319. align-self: center;
  320. font-size: 29rpx;
  321. font-weight: 700;
  322. }
  323. }
  324. .bottom {
  325. padding: 30rpx 20rpx;
  326. display: flex;
  327. justify-content: flex-end;
  328. .refuse {
  329. margin-right: 30rpxs;
  330. border: 1rpx solid orangered;
  331. border-radius: 35rpx;
  332. color: orangered;
  333. padding: 13rpx 34rpx;
  334. }
  335. .btn {
  336. background: #1372FF;
  337. border-radius: 35rpx;
  338. color: white;
  339. padding: 13rpx 34rpx;
  340. margin-left: 30rpx;
  341. }
  342. .detail {
  343. border: 1rpx solid darkgrey;
  344. border-radius: 35rpx;
  345. color: darkgrey;
  346. padding: 13rpx 34rpx;
  347. }
  348. }
  349. }
  350. }
  351. }
  352. </style>