orderList.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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">{{item.orderType==2?'已入住':'已核销'}}</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. if (i.orderType == 2) {
  149. this.dataList[index].arriveDate = i.arriveDate.slice(0, 10)
  150. this.dataList[index].leaveDate = i.leaveDate.slice(0, 10)
  151. }
  152. })
  153. console.log(this.dataList, 'this.dataList');
  154. } else {
  155. uni.showToast({
  156. title: res.data.msg,
  157. icon: 'none'
  158. })
  159. }
  160. }))
  161. },
  162. getOrderByStatusList() {
  163. this.$api.get('/merchant/hotel/order/getMerchantOrderPageList', {
  164. homestayId: this.homestayId,
  165. limit: this.limit,
  166. page: this.page,
  167. status: 0
  168. }).then((res => {
  169. if (res.data.code == 0) {
  170. this.dataList = res.data.data.list
  171. this.dataList.forEach((i, index) => {
  172. if (i.orderType == 2) {
  173. this.dataList[index].arriveDate = i.arriveDate.slice(0, 10)
  174. this.dataList[index].leaveDate = i.leaveDate.slice(0, 10)
  175. }
  176. })
  177. } else {
  178. uni.showToast({
  179. title: res.data.msg,
  180. icon: 'none'
  181. })
  182. }
  183. }))
  184. },
  185. handleDetail(item) {
  186. if (item.orderType == 2) {
  187. uni.navigateTo({
  188. url: '/pages/house/orderInfo?orderId=' + item.id
  189. })
  190. } else {
  191. uni.navigateTo({
  192. url: '/pages/house/orderDetails?orderId=' + item.id
  193. })
  194. }
  195. },
  196. changeTab(index) {
  197. console.log(index, 'index------');
  198. this.tabIdx = index;
  199. switch (index) {
  200. case 0:
  201. this.getOrderList()
  202. break
  203. case 1:
  204. this.getOrderList(-1)
  205. break
  206. case 2:
  207. // this.getOrderByStatusList(-2)
  208. this.getOrderList(-2)
  209. break
  210. case 3:
  211. this.getOrderList(1)
  212. break
  213. case 4:
  214. this.getOrderList(5)
  215. break
  216. }
  217. },
  218. }
  219. }
  220. </script>
  221. <style lang="scss" scoped>
  222. .pages {
  223. background: #F9FAFC;
  224. .tb {
  225. width: 100%;
  226. top: 0;
  227. left: 0;
  228. z-index: 999;
  229. .searchBoxParent {
  230. width: 100%;
  231. background: #fff;
  232. padding: 20rpx 24rpx 6rpx;
  233. box-sizing: border-box;
  234. .searchBox {
  235. width: 100%;
  236. background-color: #fff;
  237. }
  238. }
  239. .tabs {
  240. background: #fff;
  241. padding: 26rpx 0;
  242. display: flex;
  243. align-items: center;
  244. width: 100%;
  245. &>view {
  246. width: 25%;
  247. font-size: 28rpx;
  248. font-family: PingFangSC-Regular, PingFang SC;
  249. font-weight: 400;
  250. color: black;
  251. line-height: 40rpx;
  252. position: relative;
  253. text-align: center;
  254. }
  255. .active {
  256. font-size: 32rpx;
  257. font-family: PingFang-SC-Bold, PingFang-SC;
  258. font-weight: bold;
  259. color: black;
  260. line-height: 45rpx;
  261. }
  262. .active::after {
  263. position: absolute;
  264. content: '';
  265. width: 50rpx;
  266. height: 8rpx;
  267. background: #1372FF;
  268. bottom: -26rpx;
  269. left: 60%;
  270. margin-left: -42rpx;
  271. }
  272. }
  273. }
  274. .green {}
  275. .mainContain {
  276. display: flex;
  277. flex-direction: column;
  278. padding: 0 20rpx;
  279. .nodata {
  280. background: white;
  281. }
  282. .card {
  283. background: #fff;
  284. border-radius: 16rpx;
  285. margin: 20rpx 0;
  286. padding: 20rpx;
  287. .header {
  288. display: flex;
  289. justify-content: space-between;
  290. border-bottom: 1px #f3f3f3 solid;
  291. padding: 20rpx;
  292. .red {
  293. color: indianred;
  294. }
  295. .green {
  296. color: #39CE77;
  297. }
  298. .blue {
  299. color: #1372FF;
  300. }
  301. .grey {
  302. color: #4C5F76;
  303. }
  304. .orange {
  305. color: #FF9100;
  306. }
  307. }
  308. .mainContent {
  309. border-bottom: 1px #f3f3f3 solid;
  310. display: flex;
  311. padding: 20rpx 0;
  312. justify-content: space-evenly;
  313. .image {
  314. background-repeat: no-repeat;
  315. background-size: cover;
  316. width: 198rpx;
  317. height: 180rpx;
  318. border-radius: 16rpx;
  319. }
  320. .middle {
  321. color: #777777;
  322. display: flex;
  323. flex-direction: column;
  324. justify-content: space-between;
  325. margin-left: 25rpx;
  326. .title {
  327. font-weight: 700;
  328. font-size: 32rpx;
  329. color: black;
  330. }
  331. .info {
  332. color: #777777;
  333. display: flex;
  334. flex-direction: column;
  335. &>span {
  336. margin-top: 10rpx;
  337. }
  338. }
  339. }
  340. .price {
  341. color: red;
  342. text-align: center;
  343. height: 100%;
  344. align-items: center;
  345. align-self: center;
  346. font-size: 29rpx;
  347. font-weight: 700;
  348. }
  349. }
  350. .bottom {
  351. padding: 30rpx 20rpx;
  352. display: flex;
  353. justify-content: flex-end;
  354. .refuse {
  355. margin-right: 30rpxs;
  356. border: 1rpx solid orangered;
  357. border-radius: 35rpx;
  358. color: orangered;
  359. padding: 13rpx 34rpx;
  360. }
  361. .btn {
  362. background: #1372FF;
  363. border-radius: 35rpx;
  364. color: white;
  365. padding: 13rpx 34rpx;
  366. margin-left: 30rpx;
  367. }
  368. .detail {
  369. border: 1rpx solid darkgrey;
  370. border-radius: 35rpx;
  371. color: darkgrey;
  372. padding: 13rpx 34rpx;
  373. }
  374. }
  375. }
  376. }
  377. }
  378. </style>