orderList.vue 10 KB

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