index.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423
  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 style="margin-right: 15rpx;">{{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)
  113. this.changeTab1(type)
  114. } else {
  115. this.getOrderList()
  116. }
  117. },
  118. methods: {
  119. // 去详情
  120. navTo(item) {
  121. uni.navigateTo({
  122. url: '/pagesHouse/Mine/ordersList/details/details?list=' + JSON.stringify(item)
  123. })
  124. },
  125. // 核销
  126. handleDetail(item) {
  127. let dto = {
  128. writeOffCode: item.orderCode
  129. }
  130. this.$api.post('/merchant/merchantFisherman/home/writeOffOrder?dto=', dto).then(res => {})
  131. },
  132. // 删除
  133. Detail(item) {
  134. this.$api.del('/merchant/merchantFisherman/home', [
  135. item.id
  136. ]).then(res => {
  137. if (res.data.code == 0) {
  138. this.$showToast('删除成功');
  139. this.getOrderList()
  140. } else {
  141. this.$showToast('删除失败');
  142. this.getOrderList()
  143. }
  144. })
  145. },
  146. changeTab1(index) {
  147. this.current = index;
  148. if (index === 0) this.state = '';
  149. else if (index === 1) this.state = '0'
  150. else if (index === 2) this.state = '4';
  151. else if (index === 3) this.state = '3';
  152. else if (index === 4) this.state = '-3';
  153. // else this.FormData.status = '0,1,-1,2,-2,-3,3,4,5,6,7,8,9,10,11';
  154. this.changeTab(index)
  155. },
  156. getOrderList(state) {
  157. this.$api.get('/merchant/merchantFisherman/home/queryMyOrderPage', {
  158. // fishermanId:this.homestayId,
  159. limit: this.limit,
  160. page: this.page,
  161. state: state ? state : ''
  162. }).then((res => {
  163. if (res.data.code == 0) {
  164. this.dataList = res.data.data.list
  165. } else {
  166. uni.showToast({
  167. title: res.data.msg,
  168. icon: 'none'
  169. })
  170. }
  171. }))
  172. },
  173. getOrderByStatusList(state) {
  174. this.$api.get('/merchant/merchantFisherman/home/queryMyOrderPage', {
  175. // fishermanId:this.homestayId,
  176. limit: this.limit,
  177. page: this.page,
  178. state: state
  179. }).then((res => {
  180. if (res.data.code == 0) {
  181. this.dataList = res.data.data.list
  182. } else {
  183. uni.showToast({
  184. title: res.data.msg,
  185. icon: 'none'
  186. })
  187. }
  188. }))
  189. },
  190. changeTab(index) {
  191. this.tabIdx = index;
  192. switch (index) {
  193. case 0:
  194. this.getOrderList()
  195. break
  196. case 1:
  197. // this.getOrderList(0)
  198. this.getOrderByStatusList(0)
  199. break
  200. case 2:
  201. this.getOrderList(4)
  202. break
  203. case 3:
  204. this.getOrderList(3)
  205. break
  206. case 4:
  207. this.getOrderList(-3)
  208. break
  209. }
  210. },
  211. }
  212. }
  213. </script>
  214. <style lang="scss" scoped>
  215. .pages {
  216. background: #F9FAFC;
  217. box-sizing: border-box;
  218. .tb {
  219. width: 100%;
  220. top: 0;
  221. left: 0;
  222. z-index: 999;
  223. .searchBoxParent {
  224. width: 100%;
  225. background: #fff;
  226. padding: 20rpx 24rpx 6rpx;
  227. box-sizing: border-box;
  228. .searchBox {
  229. width: 100%;
  230. background-color: #fff;
  231. }
  232. }
  233. .tabs {
  234. background: #fff;
  235. padding: 26rpx 0;
  236. display: flex;
  237. align-items: center;
  238. width: 100%;
  239. &>view {
  240. width: 25%;
  241. font-size: 28rpx;
  242. font-family: PingFangSC-Regular, PingFang SC;
  243. font-weight: 400;
  244. color: black;
  245. line-height: 40rpx;
  246. position: relative;
  247. text-align: center;
  248. }
  249. .active {
  250. font-size: 32rpx;
  251. font-family: PingFang-SC-Bold, PingFang-SC;
  252. font-weight: bold;
  253. color: black;
  254. line-height: 45rpx;
  255. }
  256. .active::after {
  257. position: absolute;
  258. content: '';
  259. width: 50rpx;
  260. height: 8rpx;
  261. background: #007A69;
  262. bottom: -26rpx;
  263. left: 60%;
  264. margin-left: -42rpx;
  265. }
  266. }
  267. }
  268. .green {}
  269. .mainContain {
  270. display: flex;
  271. flex-direction: column;
  272. padding: 0 20rpx;
  273. .nodata {
  274. background: white;
  275. }
  276. .card {
  277. background: #fff;
  278. border-radius: 16rpx;
  279. margin: 20rpx 0;
  280. padding: 20rpx;
  281. .header {
  282. display: flex;
  283. justify-content: space-between;
  284. border-bottom: 1px #f3f3f3 solid;
  285. padding: 20rpx;
  286. .red {
  287. color: indianred;
  288. }
  289. .green {
  290. color: #999999;
  291. }
  292. .blue {
  293. color: #1372FF;
  294. }
  295. .grey {
  296. color: #4C5F76;
  297. }
  298. .orange {
  299. color: #FF9100;
  300. }
  301. }
  302. .mainContent {
  303. border-bottom: 1px #f3f3f3 solid;
  304. display: flex;
  305. padding: 20rpx 0;
  306. // justify-content: space-evenly;
  307. .image {
  308. background-repeat: no-repeat;
  309. background-size: cover;
  310. width: 198rpx;
  311. height: 180rpx;
  312. border-radius: 16rpx;
  313. }
  314. .middle {
  315. padding-top: 16rpx;
  316. color: #777777;
  317. // display: flex;
  318. // flex-direction: column;
  319. // justify-content: space-between;
  320. margin-left: 25rpx;
  321. width: 100%;
  322. .title {
  323. font-weight: 700;
  324. font-size: 32rpx;
  325. color: black;
  326. }
  327. .info {
  328. padding-top: 30rpx;
  329. color: #777777;
  330. // display: flex;
  331. // flex-direction: column;
  332. &>span {
  333. margin-top: 10rpx;
  334. }
  335. }
  336. }
  337. .price {
  338. color: red;
  339. text-align: center;
  340. height: 100%;
  341. align-items: center;
  342. align-self: center;
  343. font-size: 29rpx;
  344. font-weight: 700;
  345. }
  346. }
  347. .bottom {
  348. // padding: 30rpx 20rpx;
  349. display: flex;
  350. justify-content: flex-end;
  351. .detail {
  352. // border: 1rpx solid darkgrey;
  353. border-radius: 16rpx;
  354. color: darkgrey;
  355. padding: 13rpx 34rpx;
  356. background-color: #F6F6F6;
  357. font-size: 26rpx;
  358. color: #333333;
  359. font-weight: Regular;
  360. }
  361. .del {
  362. border-radius: 16rpx;
  363. color: darkgrey;
  364. padding: 13rpx 34rpx;
  365. background-color: #007A69;
  366. font-size: 26rpx;
  367. color: #fff;
  368. font-weight: Regular;
  369. }
  370. }
  371. }
  372. }
  373. }
  374. </style>