car.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. <template>
  2. <view>
  3. <view class="tab">
  4. <u-tabs :list="tab" :scrollable="false" itemStyle="width:200px;height:50px" lineWidth="60" @click="click"></u-tabs>
  5. </view>
  6. <view class="goodsList">
  7. <view class="item" v-for="(item, index) in driverList" :key="index">
  8. <view class="title">{{item.createTime}}</view>
  9. <view class="state" v-if="item.driverResult == 0">
  10. <text class="icon">&#xe830;</text>
  11. <text>待确认</text>
  12. </view>
  13. <view class="state" v-if="item.driverResult == 1">
  14. <text class="icon" style="color: #13ce66">&#xe830;</text>
  15. <text>已确认</text>
  16. </view>
  17. <view class="state" v-if="item.driverResult == 2">
  18. <text class="icon" style="color: #f44336">&#xe830;</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" style="display: flex;">
  24. <u-icon name="map" color="#2979ff" size="20"></u-icon>贸易地点:{{ item.tradeAreaName }}</view>
  25. <view class="productName omit" style="display: flex; margin-top: 10px;">
  26. <u-icon name="bag" color="#FF7F00" size="22"></u-icon>运送货物:{{ item.goodsName }}
  27. </view>
  28. </view>
  29. <view class="clear"></view>
  30. <view class="op">
  31. <view class="date">2022-12-12:12:12</view>
  32. <template v-if="item.driverResult == 0">
  33. <view class="an" style="color: #f44336" @click.stop="confirm(item, 2, '确认拒绝?')">拒绝接单</view>
  34. <view class="an" style="color: #4581fb" @click.stop="confirm(item, 1, '确认接单?')">确认接单</view>
  35. </template>
  36. </view>
  37. </view>
  38. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  39. <u-empty v-if="!loadMore && driverList.length == 0"></u-empty>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. data() {
  46. return {
  47. tab: [
  48. { name: '待确认', driverResult: 0},
  49. { name: '已确认', driverResult: 1},
  50. { name: '已拒绝', driverResult: 2},
  51. ],
  52. param: { pageNo: 1, pageSize: 10},
  53. loadMore: true,
  54. driverList: [],
  55. }
  56. },
  57. onLoad() {
  58. this.getDriverOrderList()
  59. },
  60. methods: {
  61. // 司机查询订单 ?driverResult=
  62. getDriverOrderList(){
  63. this.http.request({
  64. url: '/transport-server/app/TbCarRecord/getAppList',
  65. loading: 'false',
  66. data: this.param,
  67. success: res => {
  68. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  69. if (res.data.data) {
  70. this.driverList.push(...res.data.data);
  71. }
  72. this.driverList.map(item => {
  73. if(item.createTime == this.util.getDate('day')){
  74. item.createTime = '今天'
  75. }
  76. })
  77. }
  78. });
  79. },
  80. //刷新数据
  81. refresh() {
  82. this.loadMore = true;
  83. this.param.pageNo = 1;
  84. this.driverList = [];
  85. this.getDriverOrderList();
  86. },
  87. //点击tab切换
  88. click(e) {
  89. this.param.driverResult = e.driverResult;
  90. this.refresh()
  91. },
  92. //司机处理
  93. confirm(item, type, content){
  94. let user = this.getUser()
  95. uni.showModal({
  96. title: '提示',
  97. content: content,
  98. success: res => {
  99. if (res.confirm) {
  100. if(type == 1){
  101. let params = {
  102. carRecordId: item.id,
  103. levelOneOrderId: item.orderId,
  104. orderNo: 0,
  105. loadingAddress: "",
  106. unloadingAddress: "",
  107. comment: "",
  108. tradeAreaId: item.tradeAreaId,
  109. tradeAreaName: item.tradeAreaName,
  110. driverId: item.driverId,
  111. driverName: user.name,
  112. driverPhone: user.phone,
  113. vehicleId: item.vehicleId,
  114. vehicleName: 0,
  115. vehicleType: item.vehicleType
  116. }
  117. this.http.request({
  118. url: '/transport-server/app/TbDriver/driverAgree',
  119. data: params,
  120. method: 'POST',
  121. contentType: 'application/json;charset=UTF-8',
  122. success: resp => {
  123. uni.showToast({ title: '操作成功' });
  124. this.refresh();
  125. }
  126. });
  127. }else{
  128. let params = {
  129. carRecordId: item.id,
  130. enterpriseId: item.enterpriseId,
  131. enterprisePhone: item.enterprisePhone,
  132. levelOneOrderId: item.orderId
  133. }
  134. this.http.request({
  135. url: '/transport-server/app/TbDriver/driverRefuse',
  136. data: params,
  137. success: resp => {
  138. uni.showToast({ title: '操作成功' });
  139. this.refresh();
  140. }
  141. });
  142. }
  143. }
  144. }
  145. });
  146. }
  147. }
  148. }
  149. </script>
  150. <style>
  151. </style>