orderList.vue 10 KB

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