index.vue 9.1 KB

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