order.vue 4.6 KB

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