index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459
  1. <template>
  2. <view class="center">
  3. <view class="row1">
  4. <u--image class="flex-end" :showLoading="true" src="../../static/images/reders/geren.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 class="">司机</view>
  11. <view class="">车队</view>
  12. </view>
  13. <view class="driver" v-show="indexbtn == 1">
  14. <view class="flex screen">
  15. <view @click="selectAddress(1)" class="screen_item">{{title1 ? title1 : "请选择地址"}}</view>
  16. <itmister-address-picker ref="addressElone" @confirmChange="confirmChangeOne"></itmister-address-picker>
  17. <view @click="replace">--></view>
  18. <view @click="selectAddress(2)" class="screen_item">{{title2 ? title2 : "请选择地址"}}</view>
  19. <!-- <itmister-address-picker ref="addressEltwo" :wholeCountry="true" @confirmChange="confirmChangeTwo"></itmister-address-picker> -->
  20. </view>
  21. <view class="route" v-for="(item,index) in routeData">
  22. <view class="flex">{{item.driverNickname}}
  23. <view class="" style="margin-left: 30px;" @click="invitation(item)">邀请</view>
  24. <u-picker :show="fleetShow" :columns="columns" @cancel="fleetClose" @confirm="invitationCheng"></u-picker>
  25. </view>
  26. <view>{{item.sendCity ? item.sendCity: item.sendProvince }}{{item.sendArea}} ----->
  27. {{item.unloadCity ? item.unloadCity: item.unloadProvince }}{{item.unloadArea}}
  28. </view>
  29. </view>
  30. <view v-if="routeData.length == 0">
  31. <u-empty mode="search" icon="http://cdn.uviewui.com/uview/empty/car.png"></u-empty>
  32. </view>
  33. </view>
  34. <view class="" v-show="indexbtn == 2">
  35. <view class="flex">
  36. <view @click="selectChange" class="screen_item">{{city ? city : province}}</view>
  37. <!-- <itmister-address-picker ref="addressElthree" :showCheck="false" @confirmChange="confirmChangethree"></itmister-address-picker> -->
  38. <u-search placeholder="输入车队信息关键字" v-model="searchKeyWord" @change="getList" maxlength="15"></u-search>
  39. </view>
  40. <view v-for="(item,index) in formData" class="flex fleet">
  41. <view class="fleet_right">
  42. <view class="flex">
  43. <view class="fleet_name">
  44. {{item.fleetName}}({{item.fleetMemberNum}})
  45. </view>
  46. <view class="fleet_invite" v-if="!item.fleetMemberStatus" @click="joinFleet(item)">加入</view>
  47. <view class="fleet_invite" v-else @click="joinFleet(item)">{{item.fleetMemberStatus}}</view>
  48. </view>
  49. <view class="">
  50. <u-upload class="uview-upload" :fileList="item.img" :deletable="false" name="1" multiple
  51. :maxCount="1">
  52. </u-upload>
  53. </view>
  54. <view>
  55. {{item.fleetProfile}}
  56. </view>
  57. </view>
  58. </view>
  59. <view v-if="formData.length == 0">
  60. <u-empty mode="data" icon="http://cdn.uviewui.com/uview/empty/car.png"></u-empty>
  61. </view>
  62. </view>
  63. <u-toast ref="uToast"></u-toast>
  64. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
  65. confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick" @cancel="cancelClick"></u-modal>
  66. <u-modal :show="tipsShow" :content='tipsText' :confirmText="btnTips" @confirm="authentication"></u-modal>
  67. </view>
  68. </template>
  69. <script>
  70. import itmisterAddressPicker from '@/components/itmister-address-picker/itmister-address-picker.nvue'
  71. export default {
  72. components: {
  73. itmisterAddressPicker
  74. },
  75. data() {
  76. return {
  77. indexbtn: 1,
  78. routeData: [], //列表
  79. // show1: false,
  80. // show2: false,
  81. title1: "",
  82. title2: "",
  83. sendInfo: {
  84. sendProvince: "",
  85. sendCity: "",
  86. sendArea: ""
  87. },
  88. unloadInfo: {
  89. unloadProvince: "",
  90. unloadCity: "",
  91. unloadArea: ""
  92. },
  93. fleetLocation:{},
  94. formData: [],
  95. searchKeyWord: "",
  96. province: "", //省
  97. city: "", //市
  98. alertTitle: "",
  99. isShowAlert: false,
  100. commonId: "",
  101. addMember: {},
  102. tipsShow:false,
  103. tipsText:"",
  104. btnTips:'去认证',
  105. fleetShow:false,
  106. columns:[],
  107. fleetInviteList:[]
  108. }
  109. },
  110. created() {},
  111. onShow() {
  112. if (uni.getStorageSync("sendInfo")) { //从缓存中获取 上一次的装车地 卸车地
  113. this.sendInfo = uni.getStorageSync("sendInfo")
  114. this.title1 = this.sendInfo.sendProvince + this.sendInfo.sendCity + this.sendInfo.sendArea
  115. } else {
  116. this.sendInfo.sendProvince = "北京"
  117. this.title1 = "北京"
  118. }
  119. if (uni.getStorageSync("unloadInfo")) {
  120. this.unloadInfo = uni.getStorageSync("unloadInfo")
  121. this.title2 = this.unloadInfo.unloadProvince + this.unloadInfo.unloadCity + this.unloadInfo.unloadArea
  122. } else {
  123. this.title2 = '全国'
  124. this.unloadInfo.unloadProvince = '全国'
  125. }
  126. if(uni.getStorageSync("fleetLocation")){
  127. this.province = uni.getStorageSync("fleetLocation").province
  128. this.city = uni.getStorageSync("fleetLocation").city
  129. }else{
  130. this.province = ''
  131. this.city = '北京'
  132. }
  133. this.commonId = uni.getStorageSync("firstAuthentication").commonId
  134. if(uni.getStorageSync("firstAuthentication")){
  135. this.statusVal = uni.getStorageSync("firstAuthentication").authenticationStatus
  136. if(this.statusVal == '未认证'){
  137. this.tipsShow = true
  138. this.tipsText = "认证司机身份后,可查看车友信息"
  139. }
  140. if(this.statusVal == '审核中'){
  141. this.tipsShow = true
  142. this.tipsText = "司机身份审核中"
  143. this.btnTips = "我知道了"
  144. }else if(this.statusVal == '未通过'){
  145. this.tipsShow = true
  146. this.tipsText = "司机身份未通过审核"
  147. this.btnTips = "重新认证"
  148. }
  149. }else{
  150. this.tipsShow = true
  151. this.tipsText = "您尚未登录,请前去登录!"
  152. this.btnTips = "去登录"
  153. }
  154. this.getList()
  155. },
  156. onLoad() {},
  157. methods: {
  158. fleetClose(){
  159. this.fleetShow = false
  160. },
  161. invitation(item){
  162. this.addMember={}
  163. this.columns = []
  164. this.addMember.commonId = item.commonId
  165. this.addMember.driverNickname = item.driverNickname
  166. this.addMember.driverPortrait = item.driverPortrait
  167. this.$request.baseRequest('get', '/fleetInfo/fleetInfos', {
  168. commonId: this.commonId,
  169. }).then(res => {
  170. this.fleetInviteList = res.data
  171. let flrrtArray = []
  172. for(let i = 0 ; i < res.data.length ; i++){
  173. flrrtArray.push(res.data[i].fleetName)
  174. }
  175. this.columns.push(flrrtArray)
  176. if(this.columns.length == 0){
  177. uni.$u.toast("无可邀请的车队");
  178. }else{
  179. this.fleetShow = true
  180. }
  181. })
  182. .catch(res => {
  183. uni.$u.toast(res.message);
  184. });
  185. },
  186. invitationCheng(e){//邀请
  187. this.addMember.fleetId = this.fleetInviteList[e.indexs[0]].id
  188. this.fleetShow = false
  189. this.addMember.joinFlag = 2
  190. this.$request.baseRequest('post', '/fleetMemberInfo/api/addFleetMemberInfo',this.addMember).then(res => {
  191. if(res.code == 200){
  192. this.$refs.uToast.show({
  193. type: 'success',
  194. message: "邀请已发出",
  195. })
  196. }else{
  197. uni.$u.toast(res.message);
  198. }
  199. })
  200. .catch(res => {
  201. uni.$u.toast(res.message);
  202. });
  203. },
  204. authentication(){
  205. this.tipsShow = false
  206. if(this.statusVal == '未认证'){
  207. this.$u.route("/pages/mine/driverCertification")
  208. }else if(this.statusVal == '未通过'){
  209. this.$u.route("/pages/mine/editDriverCertification")
  210. }else if(this.statusVal == '审核中'){
  211. // this.$u.route("")
  212. uni.switchTab({
  213. url: '/pages/mine/index'
  214. });
  215. }else{
  216. uni.$u.route('/pages/public/login');
  217. }
  218. },
  219. selectAddress(num) {
  220. if(num == 1){
  221. this.$refs.addressElone.show();
  222. }else if(num == 2){
  223. this.$refs.addressEltwo.show();
  224. }
  225. },
  226. selectChange(){
  227. this.$refs.addressElthree.show();
  228. },
  229. // 确认选中
  230. confirmChangeOne(address) {
  231. if(address.province == '全国'){
  232. uni.$u.toast("发货地不可以是全国")
  233. // this.$refs.addressElone.show();
  234. return
  235. }
  236. this.sendInfo.sendProvince = address.province ? address.province : ''
  237. this.sendInfo.sendCity = address.city ? address.city : ''
  238. this.sendInfo.sendArea = address.area ? address.area : ''
  239. if(address.city == '全省'){
  240. this.title1 = address.province
  241. this.sendInfo.sendCity = ""
  242. this.sendInfo.sendArea = ""
  243. }else if(address.area == '全市'){
  244. this.title1 = address.province + address.city
  245. this.sendInfo.sendArea = ""
  246. }else{
  247. this.title1 = address.province + address.city + address.area;
  248. }
  249. uni.setStorageSync("sendInfo",this.sendInfo)
  250. this.getList()
  251. },
  252. confirmChangeTwo(address) {
  253. this.unloadInfo.unloadProvince = address.province ? address.province : ''
  254. this.unloadInfo.unloadCity = address.city ? address.city : ''
  255. this.unloadInfo.unloadArea = address.area ? address.area : ''
  256. if(address.city == '全省'){
  257. this.title2 = address.province
  258. this.unloadInfo.unloadCity = ""
  259. this.unloadInfo.unloadArea = ""
  260. }else if(address.area == '全市'){
  261. this.title2 = address.province + address.city
  262. this.unloadInfo.unloadArea = ""
  263. }else{
  264. this.title2 = address.province + address.city + address.area;
  265. }
  266. uni.setStorageSync("unloadInfo",this.unloadInfo)
  267. this.getList()
  268. },
  269. confirmChangethree(address){
  270. this.province = address.province
  271. this.city = address.city
  272. if(address.city == "全省"){
  273. this.city = ""
  274. }
  275. this.fleetLocation.province = address.province
  276. this.fleetLocation.city = address.city
  277. uni.setStorageSync("fleetLocation",this.fleetLocation)
  278. this.getList()
  279. },
  280. joinFleet(item) {
  281. this.addMember.commonId = this.commonId
  282. this.addMember.driverNickname = uni.getStorageSync("firstAuthentication").driverCall
  283. this.addMember.driverPortrait = uni.getStorageSync("userInfo").avatarUrl
  284. this.addMember.fleetId = item.id
  285. this.alertTitle = "确定申请加入该车队?"
  286. this.isShowAlert = true
  287. },
  288. // addressChange(num) {
  289. // if (num == 1) {
  290. // this.show1 = true
  291. // this.show2 = false
  292. // } else {
  293. // this.show1 = false
  294. // this.show2 = true
  295. // }
  296. // },
  297. cancelClick() {
  298. this.isShowAlert = false
  299. },
  300. confirmClick() {
  301. this.isShowAlert = false
  302. this.addMember.joinFlag = 1
  303. this.$request.baseRequest('post', '/fleetMemberInfo/api/addFleetMemberInfo', this.addMember).then(res => {
  304. if (res.code == '200') {
  305. this.$refs.uToast.show({
  306. type: 'success',
  307. message: "申请成功,等待队长审核",
  308. })
  309. this.getList()
  310. }else{
  311. this.$refs.uToast.show({
  312. type: 'success',
  313. message: "申请失败,请稍后重试",
  314. })
  315. }
  316. })
  317. .catch(res => {
  318. uni.$u.toast(res.message);
  319. });
  320. },
  321. getList() {
  322. if (this.indexbtn == 1) {
  323. this.$request.baseRequest('get', '/commonRoute/select', {
  324. pageSize: 10,
  325. currentPage: 1,
  326. sendProvince: this.sendInfo.sendProvince,
  327. sendCity: this.sendInfo.sendCity,
  328. sendArea: this.sendInfo.sendArea,
  329. unloadProvince: this.unloadInfo.unloadProvince,
  330. unloadCity: this.unloadInfo.unloadCity,
  331. unloadArea: this.unloadInfo.unloadArea
  332. }).then(res => {
  333. if (res.code == 200) {
  334. this.routeData = res.data.records
  335. }
  336. })
  337. .catch(res => {
  338. uni.$u.toast(res.message);
  339. });
  340. } else {
  341. this.$request.baseRequest('get', '/fleetInfo/selectFleetInfo', {
  342. commonId: this.commonId,
  343. province: this.province, //省
  344. city: this.city, //市
  345. searchKeyWord: this.searchKeyWord,
  346. pageSize: 10,
  347. currentPage: 1
  348. }).then(res => {
  349. this.formData = res.data.records
  350. let that = this
  351. for (let i = 0; i < this.formData.length; i++) {
  352. if (this.formData[i].fleetUrl) {
  353. this.formData[i].img = []
  354. let imgList = this.formData[i].fleetUrl.split(",")
  355. for (let j = 0; j < imgList.length; j++) {
  356. that.formData[i].img.push({
  357. url: imgList[j]
  358. })
  359. }
  360. }
  361. }
  362. })
  363. .catch(res => {
  364. uni.$u.toast(res.message);
  365. });
  366. }
  367. },
  368. changebtn(num) {
  369. this.indexbtn = num
  370. this.getList()
  371. },
  372. // 回调参数为包含columnIndex、value、values
  373. confirm(e) {
  374. console.log('confirm', e)
  375. this.show = false
  376. },
  377. replace() {
  378. if(this.unloadInfo.unloadProvince == "全国"){
  379. uni.$u.toast("发货地不可以是全国")
  380. return
  381. }
  382. let _obj = {}
  383. _obj = JSON.parse(JSON.stringify(this.sendInfo))
  384. this.sendInfo.sendProvince = this.unloadInfo.unloadProvince
  385. this.sendInfo.sendCity = this.unloadInfo.unloadCity
  386. this.sendInfo.sendArea = this.unloadInfo.unloadArea
  387. this.unloadInfo.unloadProvince = _obj.sendProvince
  388. this.unloadInfo.unloadCity = _obj.sendCity
  389. this.unloadInfo.unloadArea = _obj.sendArea
  390. let text = ""
  391. text = this.title1
  392. this.title1 = this.title2
  393. this.title2 = text
  394. this.getList()
  395. },
  396. myPage() {
  397. uni.$u.route("/pages/riders/myTeam")
  398. }
  399. }
  400. }
  401. </script>
  402. <style lang="scss" scoped>
  403. .center {
  404. background: #F2F4F7 ;
  405. .row1 {
  406. display: flex;
  407. justify-content: flex-end;
  408. margin-top: 46rpx;
  409. margin: 30rpx 30rpx 0 0;
  410. }
  411. .center_top {
  412. margin-top: 20rpx;
  413. padding: 0 30rpx;
  414. }
  415. }
  416. .fleet {
  417. padding: 0 30rpx;
  418. margin: 30rpx 0;
  419. // .fleet_img {
  420. // width: 20%;
  421. // }
  422. .fleet_right {
  423. margin-top: 10rpx;
  424. width: 100%;
  425. .fleet_name {
  426. width: 80%;
  427. }
  428. .fleet_invite {
  429. text-align: right;
  430. background-color: #5878e8;
  431. color: #fff;
  432. }
  433. }
  434. }
  435. .route {
  436. padding: 30rpx;
  437. }
  438. .driver {
  439. .screen {
  440. margin-top: 10rpx;
  441. .screen_item{
  442. width: 46%;
  443. text-align: center;
  444. }
  445. }
  446. }
  447. </style>