orderList.vue 7.9 KB

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