orderList.vue 8.4 KB

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