orderList.vue 8.3 KB

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