order.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  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 == 3">
  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" v-if="user.userType == 2" @click.stop="confirm(item.id, 2, item.enterpriseConfirm)">取消订单</view>
  35. <view class="an" style="color: #4581fb" v-if="user.userType == 3" @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. {
  50. name: '全部',
  51. enterpriseConfirm: '',
  52. apply: ''
  53. },
  54. {
  55. name: '待确认',
  56. enterpriseConfirm: 0,
  57. apply: 0
  58. }, //enterpriseConfirm:商户确认(0=待确认,1=是,2=否)
  59. {
  60. name: '申报中',
  61. enterpriseConfirm: 1,
  62. apply: 0
  63. },
  64. {
  65. name: '已完成',
  66. enterpriseConfirm: 2,
  67. apply: 1
  68. }, //apply:申报[0=待申报,1=申报通过,2=申报不通过]
  69. {
  70. name: '已取消',
  71. enterpriseConfirm: 3,
  72. apply: ''
  73. }
  74. ],
  75. param: {
  76. pageNo: 1,
  77. pageSize: 10
  78. },
  79. list: [],
  80. loadMore: true,
  81. user: this.getUser()
  82. };
  83. },
  84. onLoad() {
  85. this.getData();
  86. },
  87. methods: {
  88. getData() {
  89. this.http.request({
  90. url: '/level-one-server/app/TbOrder/getList',
  91. loading: 'false',
  92. data: this.param,
  93. success: res => {
  94. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  95. if (res.data.data) {
  96. this.list.push(...res.data.data);
  97. }
  98. this.list.map(item => {
  99. if (item.cancelPeople == 1) {
  100. item.enterpriseConfirm = 3;
  101. }
  102. });
  103. }
  104. });
  105. },
  106. //点击tab切换
  107. click(e) {
  108. console.log(e);
  109. this.param.orderStatus = e.enterpriseConfirm;
  110. this.param.apply = e.apply;
  111. this.refresh();
  112. },
  113. detail(item) {
  114. uni.navigateTo({url: '/pages/market/one/leader/detail?id=' + item.id});
  115. },
  116. //刷新数据
  117. refresh() {
  118. this.loadMore = true;
  119. this.param.pageNo = 1;
  120. this.list = [];
  121. this.getData();
  122. },
  123. //通知商家
  124. confirm(id, type, enterpriseConfirm) {
  125. if (type == 1) {
  126. uni.showModal({
  127. title: '提示',
  128. content: '是否确认接单?',
  129. success: res => {
  130. if (res.confirm) {
  131. this.http.request({
  132. url: '/level-one-server/app/TbGoodsTransit/updateEnterpriseConfirm',
  133. data: { id: id, enterpriseConfirm: 1 },
  134. method: 'POST',
  135. success: resp => {
  136. uni.showToast({ title: '操作成功' });
  137. this.refresh();
  138. }
  139. });
  140. }
  141. }
  142. });
  143. } else {
  144. uni.showModal({
  145. title: '提示',
  146. content: '是否确认取消订单?',
  147. success: res => {
  148. if (res.confirm) {
  149. this.http.request({
  150. url: '/level-one-server/app/TbOrder/cancelOrder',
  151. data: { orderId: id, orderStatus: enterpriseConfirm },
  152. success: resp => {
  153. uni.showToast({ title: '操作成功' });
  154. this.refresh();
  155. }
  156. });
  157. }
  158. }
  159. });
  160. }
  161. }
  162. },
  163. //下拉刷新
  164. onPullDownRefresh() {
  165. setTimeout(() => {
  166. this.refresh();
  167. uni.stopPullDownRefresh();
  168. }, 1000);
  169. },
  170. //上拉加载
  171. onReachBottom() {
  172. if (this.loadMore) {
  173. this.param.pageNo++;
  174. this.getData();
  175. }
  176. }
  177. };
  178. </script>
  179. <style lang="scss">
  180. page {
  181. background-color: $pg;
  182. }
  183. </style>