index.vue 8.9 KB

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