dealerList.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. <template>
  2. <view class="order-list">
  3. <view class="list-wrap">
  4. <u-sticky bgColor="#fff" class="main-sticky">
  5. <view class="search-wrap">
  6. <view class="input-wrap">
  7. <view class="input search">
  8. <u-search bgColor='#fff' :showAction='false' :placeholder="$t('base.common.inputPlaceholder')"
  9. @search="searchList" @clear='searchList' v-model="form.keyword">
  10. </u-search>
  11. <view class="sx-btn" @click="searchList">{{ $t("customer_meter.search") }}</view>
  12. </view>
  13. </view>
  14. </view>
  15. <view class="tabs-box">
  16. <u-tabs lineWidth="40" :list="vehicleTypeList" :current="vehicleTypeActive"
  17. @change="onVehicleTypeChange" lineColor="#3275F5"
  18. :itemStyle="{ 'height': '90rpx', 'padding': '0 32rpx' }">
  19. </u-tabs>
  20. </view>
  21. </u-sticky>
  22. <template v-if="driverList.length">
  23. <u-swipe-action :autoClose="false">
  24. <view v-for="item in driverList" :key="item.id" class="business-card">
  25. <u-swipe-action-item :name="item.name" :options="item.vehicleType == 1 ? fleetOptions : vehicleOptions"
  26. @click="onVehicleChange($event, item)" :disabled="item.vehicleType == 1 && vehicleTypeActive == 0">
  27. <view class="business-card-info">
  28. <view class="info-line" v-if="item.vehicleType != 1">
  29. <text class="lebel">{{ item.driver || '' }} {{ item.vehicle || '' }} </text>
  30. <text class="info">【{{$t("order.phone")+': '+item.phone}}】</text>
  31. </view>
  32. <view class="info-line" v-if="item.vehicleType == 1">
  33. <text class="lebel">{{ item.driver || '' }} {{ item.vehicle || '' }}</text>
  34. <text class="info">{{ $t("driver.fleet") }} {{ item.fleetName || '' }}</text>
  35. </view>
  36. <view class="businessStatus-info">
  37. <u--image width="100rpx" height="88rpx"
  38. :src="item.vehicleType == 1 ? '/subpages/static/czzn-img/state/fleet_vehicle.png' : '/subpages/static/czzn-img/state/private-vehicle.png'">
  39. </u--image>
  40. </view>
  41. </view>
  42. </u-swipe-action-item>
  43. </view>
  44. </u-swipe-action>
  45. </template>
  46. <template v-else>
  47. <view class="data-empty">
  48. <image src="/subpages/static/czzn-img/empty.png" mode="widthFix" style="width:100%" />
  49. <text class="empty-text">{{$t('base.common.noData')}}</text>
  50. </view>
  51. </template>
  52. <uni-fab ref="fab" horizontal="left" vertical="bottom" buttonColor="#3c9cff" @trigger="trigger"
  53. @fabClick="onClickRight" />
  54. </view>
  55. </view>
  56. </template>
  57. <script>
  58. import {
  59. getDealerVehicleList,
  60. UpdateVehicleStatus,
  61. deleteVehicle,
  62. } from '../../api/dealer'
  63. export default {
  64. data() {
  65. return {
  66. vehicleOptions: [
  67. {
  68. text: this.$t("base.button.delete"),
  69. name: "delete",
  70. style: {
  71. backgroundColor: '#f56c6c'
  72. }
  73. },
  74. {
  75. text: this.$t("base.button.update"),
  76. name: "update",
  77. style: {
  78. backgroundColor: 'rgb(0, 122, 255)'
  79. }
  80. },
  81. ],
  82. fleetOptions: [{
  83. text: this.$t("base.button.delete"),
  84. name: "delete",
  85. style: {
  86. backgroundColor: '#f56c6c'
  87. }
  88. }],
  89. keyword: '',
  90. driverList: [],
  91. form: {
  92. keyword: "",
  93. vehicleType: "0",
  94. appUserType: "3"
  95. },
  96. vehicleTypeActive: 0,
  97. vehicleTypeList: [{
  98. name: this.$t('driver.vehicle'),
  99. vehicleTypeFlag: '0',
  100. },
  101. // {
  102. // name: this.$t('driver.fleet'),
  103. // vehicleTypeFlag: '1',
  104. // }
  105. ],
  106. }
  107. },
  108. onShow() {
  109. this.getDriverList()
  110. },
  111. methods: {
  112. onVehicleChange(e, item) {
  113. var that = this;
  114. if (e.index == 0) {
  115. //删除
  116. uni.showModal({
  117. // title: '提示',
  118. content: that.$t("driver.deleteVehcile"),
  119. showCancel: true,
  120. cancelText: that.$t("base.search.cancelText"),
  121. confirmText: that.$t("base.search.submitText"),
  122. success: function (r) {
  123. if (r.confirm) {
  124. deleteVehicle(item).then(res => {
  125. if (res.statusCode == 200) {
  126. that.getDriverList()
  127. }
  128. })
  129. }
  130. }
  131. })
  132. } else {
  133. let data = {
  134. vehicleType: that.vehicleTypeActive,
  135. id: item.id,
  136. driver: item.driver,
  137. phone: item.phone != "" && item.phone != null ? item.phone : "",
  138. vehicle: item.vehicle,
  139. axle: item.axle,
  140. idCard:item.idCard || '',
  141. idCardImage:item.idCardImage || ''
  142. }
  143. let queryString = Object.keys(data).map(key => key + '=' + data[key]).join('&');
  144. uni.navigateTo({
  145. url: `/subpages/driver/dealerAddVehicle?${queryString}`
  146. })
  147. }
  148. },
  149. //跳转添加司机表单
  150. onClickRight() {
  151. uni.navigateTo({
  152. url: '/subpages/driver/dealerAddVehicle?vehicleType=' + this.vehicleTypeActive
  153. })
  154. },
  155. //搜索列表
  156. searchList() {
  157. this.getDriverList()
  158. },
  159. getDriverList() {
  160. var that = this;
  161. getDealerVehicleList(that.form).then(res => {
  162. if (res.statusCode == 200) {
  163. that.driverList = res.data.data
  164. console.log("获取到司机列表", that.driverList);
  165. }
  166. })
  167. },
  168. onVehicleTypeChange(item) {
  169. this.vehicleTypeActive = item.vehicleTypeFlag
  170. this.form.vehicleType = item.vehicleTypeFlag
  171. this.getDriverList()
  172. },
  173. }
  174. }
  175. </script>
  176. <style>
  177. /* #ifndef H5 */
  178. page {
  179. /* height: 100%; */
  180. background-color: #f2f2f2;
  181. }
  182. /* #endif */
  183. </style>
  184. <style lang="scss" scoped>
  185. @import '../../common/css/public.scss';
  186. </style>