index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. <template>
  2. <view class="center">
  3. <view class="row1">
  4. <u--image class="flex-end" :showLoading="true" src="../../static/images/mine/saoma.png" width="30px"
  5. height="30px" @click="myPage"></u--image>
  6. </view>
  7. <view class="flex center_top">
  8. <u-button :type="indexbtn == 1? 'primary':''" @click="changebtn(1)">司机</u-button>
  9. <u-button :type="indexbtn == 2? 'primary':''" @click="changebtn(2)">车队</u-button>
  10. </view>
  11. <view class="driver" v-if="indexbtn == 1">
  12. <view class="flex" >
  13. <!-- <regionPicker :multiIndex_="selections1" @region_="regionChange1" custom_="请选择"
  14. @selecteRegion_="selecteRegion1" title_="全国" /> -->
  15. <!-- <view > -->
  16. <view @click="addressChange(1)">{{title1 ? title1 : "请选择地址"}}</view>
  17. <Linkage @conceal="conceal1" class="flex" v-show="show1" ref="uDropdown"></Linkage>
  18. <!-- </view> -->
  19. <view @click="replace">--></view>
  20. <!-- <view style="margin-left: 60px;"> -->
  21. <view @click="addressChange(2)">{{title2 ? title2 : "请选择地址"}}</view>
  22. <Linkage @conceal="conceal2" class="flex" v-show="show2" ref="uDropdown"></Linkage>
  23. <!-- </view> -->
  24. </view>
  25. <view class="" v-for="(item,index) in routeData">
  26. <view>{{item.driverNickname}}</view>
  27. <view>{{item.sendCity ? item.sendCity: item.sendProvince }}{{item.sendArea}} ----->
  28. {{item.unloadCity ? item.unloadCity: item.unloadCity }}{{item.unloadArea}} </view>
  29. </view>
  30. </view>
  31. <view class="driver" v-if="indexbtn == 2">
  32. <!-- <view @click="show = true">sss</view> -->
  33. <!-- <u-picker :show="show" ref="uPicker" :columns="fprovincelist" @confirm="confirm" @change="changeHandler"></u-picker> -->
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import regionPicker from "@/components/region/region-picker";
  39. import dataList from "@/components/region/data.js";
  40. import Linkage from '@/components/gaojianghua-linkage/linkage.vue'
  41. import {
  42. address,
  43. } from '@/components/data/data.js'
  44. export default {
  45. components: {
  46. regionPicker,
  47. Linkage
  48. },
  49. data() {
  50. return {
  51. indexbtn: 1,
  52. // fprovincelist: [],
  53. // sprovincelist: [],
  54. // show: false,
  55. selections1: [],
  56. selections2: [],
  57. // sendregion: [],
  58. // unloaddregion: [],
  59. routeData: [], //列表
  60. //
  61. show1:false,
  62. show2:false,
  63. title1:"",
  64. title2:"",
  65. sendInfo: {},
  66. unloadInfo: {},
  67. }
  68. },
  69. created() {},
  70. onShow() {
  71. this.sendInfo = uni.getStorageSync("sendInfo")
  72. this.unloadInfo = uni.getStorageSync("unloadInfo")
  73. if (this.sendInfo) {
  74. this.title1 = this.sendInfo.sendProvince + this.sendInfo.sendCity + this.sendInfo.sendArea
  75. }
  76. if (this.unloadInfo) {
  77. this.title2 = this.unloadInfo.unloadProvince + this.unloadInfo.unloadCity + this.unloadInfo.unloadArea
  78. }
  79. this.getList()
  80. },
  81. onLoad() {},
  82. methods: {
  83. addressChange(num){
  84. if(num == 1){
  85. this.show1 = true
  86. this.show2 = false
  87. }else{
  88. this.show1 = false
  89. this.show2 = true
  90. }
  91. },
  92. getList() {
  93. this.$request.baseRequest('get', '/commonRoute/select', {
  94. pageSize: 10,
  95. currentPage: 1,
  96. sendProvince: this.sendInfo.sendProvince,
  97. sendCity: this.sendInfo.sendCity,
  98. sendArea: this.sendInfo.sendArea,
  99. unloadProvince: this.unloadInfo.unloadProvince,
  100. unloadCity: this.unloadInfo.unloadCity,
  101. unloadArea: this.unloadInfo.unloadArea
  102. }).then(res => {
  103. if (res.code == 200) {
  104. this.routeData = res.data.records
  105. }
  106. })
  107. .catch(res => {
  108. uni.$u.toast(res.message);
  109. });
  110. },
  111. changebtn(num) {
  112. this.indexbtn = num
  113. },
  114. // 回调参数为包含columnIndex、value、values
  115. confirm(e) {
  116. console.log('confirm', e)
  117. this.show = false
  118. },
  119. replace(){
  120. let _obj = {}
  121. _obj = this.sendInfo
  122. this.sendInfo = this.unloadInfo
  123. this.unloadInfo = _obj
  124. let text = ""
  125. text = this.title1
  126. this.title1 = this.title2
  127. this.title2 = text
  128. this.getList()
  129. },
  130. conceal1(param) {
  131. const {
  132. chooseprovince,
  133. choosecity,
  134. choosearea
  135. } = param
  136. // 获取到传过来的 省 市 区 县数据
  137. this.sendInfo.sendProvince = chooseprovince
  138. this.sendInfo.sendCity = choosecity == '全部' ? "" : choosecity
  139. this.sendInfo.sendArea = choosearea == '全部' ? "" : choosearea
  140. uni.setStorageSync("sendInfo", this.sendInfo)
  141. this.title1 = chooseprovince + choosecity + choosearea
  142. if (chooseprovince == '全国') {
  143. this.succeed(1)
  144. }
  145. if (choosecity == '全部') {
  146. this.succeed(1)
  147. } else if (choosearea != '') {
  148. this.succeed(1)
  149. }
  150. },
  151. conceal2(param) {
  152. const {
  153. chooseprovince,
  154. choosecity,
  155. choosearea
  156. } = param
  157. // 获取到传过来的 省 市 区 县数据
  158. this.unloadInfo.unloadProvince = chooseprovince
  159. this.unloadInfo.unloadCity = choosecity == '全部' ? "" : choosecity
  160. this.unloadInfo.unloadArea = choosearea == '全部' ? "" : choosearea
  161. uni.setStorageSync("unloadInfo", this.unloadInfo)
  162. this.title2 = chooseprovince + choosecity + choosearea
  163. if (chooseprovince == '全国') {
  164. this.succeed(2)
  165. }
  166. if (choosecity == '全部') {
  167. this.succeed(2)
  168. } else if (choosearea != '') {
  169. this.succeed(2)
  170. }
  171. },
  172. //筛选框关闭
  173. succeed(num) {
  174. // this.$refs.uDropdown.close();
  175. if (num == 1) {
  176. this.show1 = false
  177. } else if (num == 2) {
  178. this.show2 = false
  179. }
  180. this.getList()
  181. },
  182. myPage(){
  183. uni.$u.route("/pages/riders/myTeam")
  184. }
  185. // regionChange1(value) {
  186. // this.sendregion = value
  187. // this.sendInfo.sendProvince = this.sendregion[0] == '请选择' ? '' : this.sendregion[0]
  188. // this.sendInfo.sendCity = this.sendregion[1] == '请选择' ? '' : this.sendregion[1]
  189. // this.sendInfo.sendArea = this.sendregion[2] == '请选择' ? '' : this.sendregion[2]
  190. // },
  191. // regionChange2(value) {
  192. // this.unloaddregion = value
  193. // this.unloadInfo.unloadProvince = this.unloaddregion[0] == '请选择' ? '' : this.unloaddregion[0]
  194. // this.unloadInfo.unloadCity = this.unloaddregion[1] == '请选择' ? '' : this.unloaddregion[1]
  195. // this.unloadInfo.unloadArea = this.unloaddregion[2] == '请选择' ? '' : this.unloaddregion[2]
  196. // },
  197. // selecteRegion1(value) {
  198. // this.selections1 = value;
  199. // this.sendInfo.sendNum = this.selections1 ? this.selections1.toString() : ""
  200. // this.getList()
  201. // },
  202. // selecteRegion2(value) {
  203. // this.selections2 = value;
  204. // this.unloadInfo.unloadNum = this.selections2 ? this.selections2.toString() : ""
  205. // this.getList()
  206. // },
  207. }
  208. }
  209. </script>
  210. <style lang="scss" scoped>
  211. .center {
  212. .row1 {
  213. display: flex;
  214. justify-content: flex-end;
  215. margin-top: 46rpx;
  216. margin: 40rpx 30rpx 0 0;
  217. }
  218. .center_top{
  219. margin-top: 30rpx;
  220. padding: 0 30rpx;
  221. }
  222. }
  223. </style>