fleetManage.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  1. //车队管理
  2. <template>
  3. <view class="center">
  4. <view class="fleetInfo">
  5. <view class="fleetInfo_name">队长身份</view>
  6. <view class="fleetInfo_phone" v-if="fleetInfo.status">{{fleetInfo.status}}</view>
  7. <view class="fleetInfo_phone" v-else>去认证</view>
  8. </view>
  9. <view class="btn_css">
  10. <view class="btn_item" v-if="!fleetInfo">
  11. <u-button type="primary" text="去认证" @click="operation(1)"></u-button>
  12. </view>
  13. <view class="btn_item" v-else>
  14. <u-button type="primary" text="编辑" @click="operation(2)"></u-button>
  15. </view>
  16. </view>
  17. <u-divider></u-divider>
  18. <view class="list_css" v-for="(item,index) in formList">
  19. <view class="list_left">{{item.driverName}}({{item.accountNumber}})</view>
  20. <view class="list_right">
  21. <view class="list_text" v-if="item.status == '待确认'" @click="audit(item,1)">拒绝</view>
  22. <view class="list_text" v-if="item.status == '待确认'" @click="audit(item,2)">接受</view>
  23. <view class="list_text" v-if="item.status == '已绑定'">{{item.status}}</view>
  24. <view class="list_text"
  25. v-if="item.status == '已绑定'||item.status == '已解绑'||item.status == '已接受'||item.status == '已拒绝'"
  26. @click="next(item)">删除</view>
  27. </view>
  28. </view>
  29. <u-toast ref="uToast"></u-toast>
  30. <u-modal :show="tipsShow" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
  31. confirmColor='#2772FB' @confirm="$u.throttle(confirmClick, 5000)" @close="cancelClick"
  32. @cancel="cancelClick"></u-modal>
  33. </view>
  34. </template>
  35. <script>
  36. import {
  37. mapState
  38. } from 'vuex';
  39. export default {
  40. data() {
  41. return {
  42. fleetInfo: {},
  43. tipsShow: false,
  44. alertTitle: "",
  45. formList: [],
  46. distinguish: "",
  47. id: "",
  48. sign:"",
  49. }
  50. },
  51. onLoad() {
  52. this.getInfo()
  53. },
  54. onShow() {
  55. },
  56. computed: {
  57. ...mapState(['hasLogin', 'userInfo']),
  58. },
  59. onNavigationBarButtonTap(e) {
  60. this.$u.route("/pages/mine/fleet/fleetBill")
  61. },
  62. methods: {
  63. solution() {
  64. let that = this
  65. uni.showLoading({
  66. mask: true,
  67. title: '加载中'
  68. })
  69. this.tipsShow = false
  70. this.$request.baseRequest('post', '/hyBindCarCaptainInfo/api/deleteBind', {
  71. id: this.id
  72. }).then(res => {
  73. uni.hideLoading()
  74. if (res.code == 200) {
  75. this.$refs.uToast.show({
  76. type: 'success',
  77. message: "删除成功!",
  78. complete() {
  79. that.getInfo()
  80. }
  81. })
  82. } else {
  83. uni.hideLoading()
  84. uni.$u.toast(res.message);
  85. }
  86. }).catch(res => {
  87. uni.hideLoading()
  88. uni.$u.toast(res.message);
  89. });
  90. },
  91. next(obj) {
  92. this.tipsShow = true
  93. this.alertTitle = "确定删除" + obj.driverName + "信息?"
  94. this.id = obj.id
  95. this.sign="删除"
  96. },
  97. audit(obj, val) {
  98. if (val == 1) {
  99. this.alertTitle = "确定拒绝" + obj.driverName + "加入车队?"
  100. this.distinguish = "2"
  101. } else if (val == 2) {
  102. this.alertTitle = "确定接受" + obj.driverName + "加入车队?"
  103. this.distinguish = "1"
  104. }
  105. this.id = obj.id
  106. this.tipsShow = true
  107. },
  108. operation(val) {
  109. if (val == 1) {
  110. uni.$u.route('/pages/mine/fleet/carCaptainAuthentication');
  111. } else {
  112. uni.$u.route('/pages/mine/fleet/carCaptainAuthentication', {
  113. data: JSON.stringify(this.fleetInfo),
  114. });
  115. }
  116. },
  117. leave() {
  118. this.tipsShow = true
  119. },
  120. cancelClick() {
  121. this.tipsShow = false
  122. },
  123. confirmClick() {
  124. let that = this
  125. if(this.sign == "删除"){ //删除操作
  126. this.solution()
  127. }else{
  128. uni.showLoading({
  129. mask: true,
  130. title: '加载中'
  131. })
  132. this.tipsShow = false
  133. this.$request.baseRequest('post', '/hyBindCarCaptainInfo/api/examine', {
  134. id: this.id,
  135. examineFlag: this.distinguish
  136. }).then(res => {
  137. if (res.code == 200) {
  138. uni.hideLoading()
  139. if (this.distinguish == 1) {
  140. this.$refs.uToast.show({
  141. type: 'success',
  142. message: "接受成功!",
  143. complete() {
  144. that.getInfo()
  145. }
  146. })
  147. } else {
  148. this.$refs.uToast.show({
  149. type: 'success',
  150. message: "拒绝成功!",
  151. complete() {
  152. that.getInfo()
  153. }
  154. })
  155. }
  156. } else {
  157. uni.hideLoading()
  158. uni.$u.toast(res.message);
  159. }
  160. })
  161. .catch(res => {
  162. uni.hideLoading()
  163. uni.$u.toast(res.message);
  164. });
  165. }
  166. },
  167. getInfo() {
  168. this.$request.baseRequest('get', '/hyCarCaptainInfo/getCarCaptain', {
  169. commonId: this.userInfo.id
  170. }).then(res => {
  171. if (res.code == 200) {
  172. if (res.data) {
  173. this.fleetInfo = res.data
  174. //车队人员
  175. this.$request.baseRequest('get', '/hyBindCarCaptainInfo/api/selectPage', {
  176. carCaptainCommonId: this.fleetInfo.commonId,
  177. pageSize: 10,
  178. currentPage: 1
  179. }).then(res => {
  180. if (res.code == 200) {
  181. this.formList = res.data.records
  182. // if(res.data.total == 0){
  183. // this.status = 'nomore'
  184. // }else{
  185. // this.status = 'loadmore'
  186. // }
  187. }
  188. })
  189. .catch(res => {
  190. uni.$u.toast(res.message);
  191. });
  192. }
  193. } else {
  194. uni.$u.toast(res.message);
  195. }
  196. })
  197. .catch(res => {
  198. uni.$u.toast(res.message);
  199. });
  200. },
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .center {
  206. padding: 20rpx 30rpx;
  207. }
  208. .fleetInfo {
  209. display: flex;
  210. width: 100%;
  211. margin-top: 30rpx;
  212. .fleetInfo_name {
  213. width: 50%;
  214. }
  215. .fleetInfo_phone {
  216. width: 50%;
  217. text-align: right;
  218. }
  219. }
  220. .btn_css {
  221. display: flex;
  222. margin-top: 30rpx;
  223. .btn_item {
  224. width: 120rpx;
  225. margin-right: 20rpx;
  226. }
  227. }
  228. .list_css {
  229. display: flex;
  230. margin: 10rpx 0;
  231. .list_left {
  232. width: 50%;
  233. }
  234. .list_right {
  235. display: flex;
  236. justify-content: flex-end;
  237. width: 50%;
  238. .list_text {
  239. margin: 0 10rpx;
  240. }
  241. }
  242. }
  243. </style>