orderList.vue 8.0 KB

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