order.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view>
  3. <view class="tab">
  4. <u-tabs :list="tab" @click="click" :lineHeight="5"></u-tabs>
  5. </view>
  6. <view class="goodsList">
  7. <view class="item" v-for="(item, index) in list" :key="index" @click="detail(item)">
  8. <view class="title">广西京东自营店南宁分店</view>
  9. <view class="state" v-if="item.enterpriseConfirm == 0">
  10. <text class="icon">&#xe830;</text>
  11. <text>待确认</text>
  12. </view>
  13. <view class="state" v-if="item.enterpriseConfirm == 1">
  14. <text class="icon" style="color: #13ce66">&#xe830;</text>
  15. <text>已确认</text>
  16. </view>
  17. <view class="state" v-if="item.enterpriseConfirm == 2">
  18. <text class="icon" style="color: #f44336">&#xe622;</text>
  19. <text>已拒绝</text>
  20. </view>
  21. <image src="../../../../static/news.jpg" mode="aspectFill" class="pic"></image>
  22. <view class="con">
  23. <view class="productName omit">{{item.goodsNames}}</view>
  24. <view class="desc omit">
  25. <text>50吨</text>
  26. <text>{{ item.tradeAreaName }}</text>
  27. </view>
  28. <view class="price">¥ {{ item.price }}</view>
  29. </view>
  30. <view class="clear"></view>
  31. <view class="op">
  32. <view class="date">2022-12-12:12:12</view>
  33. <template v-if="item.enterpriseConfirm == 0">
  34. <view class="an" style="color: #f44336" @click.stop="confirm(item.id, 2, '确认拒绝?')">取消订单</view>
  35. <view class="an" style="color: #4581fb" @click.stop="confirm(item.id, 1, '确认接单?')">确认订单</view>
  36. </template>
  37. </view>
  38. </view>
  39. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  40. <u-empty v-if="!loadMore && list.length == 0"></u-empty>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. tab: [
  49. { name: '全部', enterpriseConfirm: '' ,apply: ''},
  50. { name: '待确认', enterpriseConfirm: 0 ,apply: 0},//enterpriseConfirm:商户确认(0=待确认,1=是,2=否)
  51. { name: '申报中', enterpriseConfirm: 1 ,apply: 0},
  52. { name: '已完成', enterpriseConfirm: 1 ,apply: 1},//apply:申报[0=待申报,1=申报通过,2=申报不通过]
  53. { name: '已取消', enterpriseConfirm: 2 ,apply: ''}
  54. ],
  55. param: { pageNo: 1, pageSize: 10},
  56. list: [],
  57. loadMore: true
  58. };
  59. },
  60. onLoad() {
  61. this.getData();
  62. },
  63. methods: {
  64. getData() {
  65. this.http.request({
  66. url: '/level-one-server/app/TbOrder/getList',
  67. loading: 'false',
  68. data: this.param,
  69. success: res => {
  70. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  71. if(res.data.data){
  72. this.list.push(...res.data.data);
  73. }
  74. }
  75. });
  76. },
  77. //点击tab切换
  78. click(e) {
  79. this.param.enterpriseConfirm = e.enterpriseConfirm;
  80. this.param.apply = e.apply
  81. this.refresh();
  82. },
  83. detail(item) {
  84. uni.navigateTo({ url: '/pages/market/one/merchant/order/detail?id=' + item.id });
  85. },
  86. //刷新数据
  87. refresh() {
  88. this.loadMore = true;
  89. this.param.pageNo = 1;
  90. this.list = [];
  91. this.getData();
  92. },
  93. //通知商家
  94. confirm(item) {
  95. uni.showModal({
  96. title: '提示',
  97. content:'是否确认通知商家?',
  98. success: res => {
  99. if (res.confirm) {
  100. this.http.request({
  101. url: '/level-one-server/app/TbGoodsTransit/update',
  102. data: { id: id, enterpriseConfirm: status },
  103. method: 'POST',
  104. success: resp => {
  105. uni.showToast({ title: '操作成功' });
  106. this.refresh();
  107. }
  108. });
  109. }
  110. }
  111. });
  112. }
  113. },
  114. //下拉刷新
  115. onPullDownRefresh() {
  116. setTimeout(() => {
  117. this.refresh();
  118. uni.stopPullDownRefresh();
  119. }, 1000);
  120. },
  121. //上拉加载
  122. onReachBottom() {
  123. if (this.loadMore) {
  124. this.param.pageNo++;
  125. this.getData();
  126. }
  127. }
  128. };
  129. </script>
  130. <style lang="scss">
  131. page {
  132. background-color: $pg;
  133. }
  134. </style>