index.vue 8.5 KB

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