index.vue 8.6 KB

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