orderList.vue 9.2 KB

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