order.vue 5.0 KB

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