index.vue 9.2 KB

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