tdSet.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453
  1. <template>
  2. <view v-if="shangxian === '否'" style="padding-bottom: 300rpx;">
  3. <view class="item_view" style="background: none;margin: 0rpx 30rpx;padding-bottom: 0rpx;">
  4. <view class=" flex justify-between center">
  5. <view class="item_name"
  6. style="width: 500rpx;text-overflow: ellipsis;white-space: nowrap;overflow: hidden;">当前位置:<text
  7. style="color: #346EF6;">{{address}}</text></view>
  8. <view class="flex align-center" @tap="getAddress">
  9. <image v-if="globalImages" :src="globalImages + 'imgs/static/upload/shuaxin.png'" style="width: 30rpx;height: 30rpx;">
  10. </image>
  11. <view class="item_name" style="margin-left: 6rpx;">刷新</view>
  12. </view>
  13. </view>
  14. <view class="item_name margin-top-sm" style="color: #346EF6;">*请勿关闭声音,避免错过消息提醒</view>
  15. </view>
  16. <view class="item_view">
  17. <view class="item_title">出行信息</view>
  18. <view class="margin-top flex justify-between">
  19. <view class="item_name">换乘车辆</view>
  20. <view class="item_name">{{driverPlate}}</view>
  21. </view>
  22. <view class="margin-top flex align-center justify-between">
  23. <view class="item_name">语音类型</view>
  24. <view class="flex">
  25. <view :class="musicType == 2 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZYY(2)">
  26. 女生
  27. </view>
  28. <view :class="musicType == 1 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZYY(1)">
  29. 男生
  30. </view>
  31. </view>
  32. </view>
  33. <view class="margin-top flex align-center justify-between">
  34. <view class="item_name">是否有亲友</view>
  35. <view class="flex">
  36. <view :class="friendsType == 2 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZQY(2)">
  37. </view>
  38. <view :class="friendsType == 1 ? 'bz_item_sel' : 'bz_item'" @tap="checkBZQY(1)">
  39. </view>
  40. </view>
  41. </view>
  42. <view class="margin-top flex align-center justify-between">
  43. <view class="item_name">可提供座位数</view>
  44. <view style="width: 272rpx;">
  45. <u-subsection :list="list" :current="current" @change="currentSel" :animation="true"
  46. height="60"></u-subsection>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="item_view">
  51. <view class="item_title">听单偏好</view>
  52. <view class="item_kuang">
  53. <view class="item_name">播市内单</view>
  54. <u-switch v-model="snShow" inactive-color="#999999"></u-switch>
  55. </view>
  56. <view class="item_kuang">
  57. <view class="item_name">播跨城单</view>
  58. <u-switch v-model="kcShow" inactive-color="#999999"></u-switch>
  59. </view>
  60. </view>
  61. <view class="item_view">
  62. <view class="item_title">换乘距离</view>
  63. <view class="margin-top">
  64. <u-slider v-model="hcNum" min="10" step="10" height="20"></u-slider>
  65. <view class="flex justify-between margin-top-sm">
  66. <view class="item_name">{{hcNum / 10}}Km</view>
  67. <view class="item_name">10Km</view>
  68. </view>
  69. </view>
  70. <view class="item_title margin-top">出发时间</view>
  71. <view class="flex margin-top-sm">
  72. <view :class="timeNum == 1 ? 'sj_item_sel' : 'sj_item'" @tap="checkBZSJ(1)">
  73. 15分钟内
  74. </view>
  75. <view :class="timeNum == 2 ? 'sj_item_sel' : 'sj_item'" @tap="checkBZSJ(2)">
  76. 30分钟内
  77. </view>
  78. <view :class="timeNum == 3 ? 'sj_item_sel' : 'sj_item'" @tap="checkBZSJ(3)">
  79. 60分钟内
  80. </view>
  81. <view :class="timeNum == 4 ? 'sj_item_sel' : 'sj_item'" @tap="checkBZSJ(4)">
  82. 全天
  83. </view>
  84. </view>
  85. <view class="item_title margin-top">独享/愿拼</view>
  86. <view class="flex margin-top-sm">
  87. <view :class="dxSel == 1 ? 'sj_item_sel' : 'sj_item'" @tap="checkBZDX(1)">
  88. 不限
  89. </view>
  90. <view :class="dxSel == 2 ? 'sj_item_sel' : 'sj_item'" @tap="checkBZDX(2)">
  91. 只接拼座
  92. </view>
  93. <view :class="dxSel == 3 ? 'sj_item_sel' : 'sj_item'" @tap="checkBZDX(3)">
  94. 只接独享
  95. </view>
  96. </view>
  97. </view>
  98. <view class="btn_view">
  99. <view class="mr_btn" @tap="mrClick">恢复默认</view>
  100. <view class="save_btn" @tap="saveSet">保持设置</view>
  101. </view>
  102. </view>
  103. </template>
  104. <script>
  105. import { waitForGlobalImages } from '@/utils/globalImageLoader'
  106. export default {
  107. data() {
  108. return {
  109. address: '',
  110. musicType: 2,
  111. driverId: '',
  112. dxSel: 1,
  113. timeNum: 4,
  114. snShow: true,
  115. kcShow: true,
  116. current: 3,
  117. list: [{
  118. name: '1'
  119. },
  120. {
  121. name: '2'
  122. },
  123. {
  124. name: '3'
  125. },
  126. {
  127. name: '4'
  128. }
  129. ],
  130. hcNum: 100,
  131. driverPlate: '',
  132. friendsType: 2,
  133. shangxian: '是',
  134. globalImages: '',
  135. }
  136. },
  137. onLoad() {
  138. waitForGlobalImages().then((path) => {
  139. console.log('✅ 全局图片路径:', path)
  140. this.globalImages = path
  141. })
  142. this.shangxian = uni.getStorageSync('shangxian')
  143. if (this.shangxian === '否') {
  144. uni.setNavigationBarTitle({
  145. title: '听单设置'
  146. })
  147. }
  148. this.getDetail();
  149. this.getAddress();
  150. },
  151. methods: {
  152. getAddress() {
  153. let that = this;
  154. that.$queue.showLoading('刷新中...')
  155. uni.getLocation({
  156. // #ifdef APP
  157. type: 'wgs84',
  158. // #endif
  159. // #ifndef APP
  160. type: 'gcj02', //wgs84 gcj02
  161. // #endif
  162. success: function(res) {
  163. console.log(res, '获取经纬度')
  164. let data = {
  165. lat: res.latitude,
  166. lng: res.longitude
  167. }
  168. that.$Request.getT('/app/Login/selectCity', data).then(res => {
  169. uni.hideLoading();
  170. if (res.code === 0 && res.data) {
  171. that.address = res.data.address
  172. }
  173. });
  174. },
  175. fail: function(ree) {
  176. uni.hideLoading();
  177. }
  178. });
  179. },
  180. currentSel(e) {
  181. this.current = e;
  182. },
  183. saveSet() {
  184. let latitude = uni.getStorageSync('latitude')
  185. let longitude = uni.getStorageSync('longitude')
  186. let city = uni.getStorageSync('cityName')
  187. let startTime = ''
  188. if (this.timeNum == 1) {
  189. startTime = '15分钟内'
  190. } else if (this.timeNum == 2) {
  191. startTime = '30分钟内'
  192. } else if (this.timeNum == 3) {
  193. startTime = '60分钟内'
  194. } else if (this.timeNum == 4) {
  195. startTime = '全天'
  196. }
  197. let data = {
  198. driverId: this.driverId,
  199. latitude: latitude,
  200. longitude: longitude,
  201. city: city,
  202. seatNum: this.current + 1,
  203. isFriends: this.friendsType,
  204. musicType: this.musicType,
  205. isCityOrders: this.snShow ? 1 : 0,
  206. isProvinceOrders: this.kcShow ? 1 : 0,
  207. ordersKm: this.hcNum / 10,
  208. ordersStartTime: startTime,
  209. ordersType: this.dxSel,
  210. }
  211. let that = this;
  212. uni.showModal({
  213. title: '温馨提示',
  214. content: '确认保存听单设置吗?',
  215. showCancel: true,
  216. cancelText: '取消',
  217. confirmText: '确认',
  218. success: red => {
  219. if (red.confirm) {
  220. that.$queue.showLoading('保存中...')
  221. that.$Request.postJson('/app/driver/updateDriver', data).then(res => {
  222. uni.hideLoading();
  223. if (res.code == 0) {
  224. that.$queue.showToast('保存成功!')
  225. setTimeout(d => {
  226. uni.navigateBack();
  227. }, 1500)
  228. } else {
  229. that.$queue.showToast(res.msg)
  230. }
  231. });
  232. }
  233. }
  234. });
  235. },
  236. mrClick() {
  237. this.dxSel = 1;
  238. this.musicType = 2;
  239. this.timeNum = 4;
  240. this.snShow = true;
  241. this.kcShow = true;
  242. this.current = 3;
  243. this.hcNum = 100;
  244. this.friendsType = 2;
  245. },
  246. checkBZDX(index) {
  247. this.dxSel = index;
  248. },
  249. checkBZSJ(index) {
  250. this.timeNum = index;
  251. },
  252. checkBZYY(index) {
  253. this.musicType = index;
  254. },
  255. checkBZQY(index) {
  256. this.friendsType = index;
  257. },
  258. getDetail() {
  259. let userId = this.$queue.getData('userId');
  260. this.$Request.getT('/app/driver/selectDriverByUserId?userId=' + userId).then(res => {
  261. if (res.code == 0 && res.data) {
  262. this.driverPlate = res.data.driverPlate
  263. this.driverId = res.data.driverId
  264. if (res.data.seatNum) {
  265. this.current = parseInt(res.data.seatNum) - 1
  266. }
  267. if (res.data.isFriends) {
  268. this.friendsType = res.data.isFriends
  269. }
  270. if (res.data.isCityOrders) {
  271. this.snShow = res.data.isCityOrders == 1 ? true : false
  272. }
  273. if (res.data.musicType) {
  274. this.musicType = res.data.musicType;
  275. }
  276. if (res.data.isProvinceOrders) {
  277. this.kcShow = res.data.isProvinceOrders == 1 ? true : false
  278. }
  279. if (res.data.ordersKm) {
  280. this.hcNum = parseInt(res.data.ordersKm) * 10
  281. }
  282. if (res.data.ordersStartTime) {
  283. // this.current = res.data.ordersStartTime
  284. if (res.data.ordersStartTime === '15分钟内') {
  285. this.timeNum = 1
  286. } else if (res.data.ordersStartTime === '30分钟内') {
  287. this.timeNum = 2
  288. } else if (res.data.ordersStartTime === '60分钟内') {
  289. this.timeNum = 3
  290. } else if (res.data.ordersStartTime === '全天') {
  291. this.timeNum = 4
  292. }
  293. }
  294. if (res.data.ordersType) {
  295. this.dxSel = res.data.ordersType
  296. }
  297. }
  298. })
  299. }
  300. }
  301. }
  302. </script>
  303. <style lang="scss">
  304. page {
  305. background: #F5F5F5;
  306. }
  307. .mr_btn {
  308. width: 214rpx;
  309. height: 98rpx;
  310. background: #FFFFFF;
  311. border-radius: 32rpx;
  312. border: 1px solid #999999;
  313. text-align: center;
  314. line-height: 98rpx;
  315. font-family: PingFang SC;
  316. font-weight: bold;
  317. font-size: 32rpx;
  318. color: #161616;
  319. }
  320. .save_btn {
  321. width: 444rpx;
  322. height: 98rpx;
  323. background: #346EF6;
  324. border-radius: 32rpx;
  325. text-align: center;
  326. line-height: 98rpx;
  327. font-family: PingFang SC;
  328. font-weight: bold;
  329. font-size: 32rpx;
  330. color: #FFFFFF;
  331. margin-left: 30rpx;
  332. }
  333. .item_view {
  334. width: 694rpx;
  335. background: #FFFFFF;
  336. border-radius: 32rpx;
  337. margin: 30rpx;
  338. padding: 30rpx;
  339. .item_title {
  340. font-family: Source Han Sans CN;
  341. font-weight: 800;
  342. font-size: 30rpx;
  343. color: #333333;
  344. }
  345. .item_kuang {
  346. width: 637rpx;
  347. height: 88rpx;
  348. background: #FFFFFF;
  349. border-radius: 24rpx;
  350. border: 1px solid #CCCCCC;
  351. align-items: center;
  352. padding: 30rpx;
  353. margin-top: 20rpx;
  354. display: flex;
  355. justify-content: space-between;
  356. }
  357. .item_name {
  358. font-family: PingFang SC;
  359. font-weight: 500;
  360. font-size: 26rpx;
  361. color: #030303;
  362. }
  363. }
  364. .btn_view{
  365. width: 750rpx;
  366. position: fixed;
  367. bottom: 0;
  368. display: flex;
  369. justify-content: space-between;
  370. padding: 30rpx;
  371. background: #FFFFFF;
  372. }
  373. .sj_item {
  374. width: 140rpx;
  375. padding: 20rpx 0rpx;
  376. text-align: center;
  377. // height: 71rpx;
  378. background: #FFFFFF;
  379. border-radius: 24rpx;
  380. border: 1px solid #CCCCCC;
  381. font-family: PingFang SC;
  382. font-weight: 500;
  383. font-size: 24rpx;
  384. color: #030303;
  385. margin-right: 20rpx;
  386. }
  387. .sj_item_sel {
  388. width: 140rpx;
  389. padding: 20rpx 0rpx;
  390. text-align: center;
  391. // height: 71rpx;
  392. background: #FFFFFF;
  393. border-radius: 24rpx;
  394. border: 1px solid #346EF6;
  395. background: #EFF4FF;
  396. font-family: PingFang SC;
  397. font-weight: 500;
  398. font-size: 24rpx;
  399. color: #346EF6;
  400. margin-right: 20rpx;
  401. }
  402. .bz_item {
  403. width: fit-content;
  404. padding: 14rpx 30rpx;
  405. // height: 71rpx;
  406. background: #FFFFFF;
  407. border-radius: 24rpx;
  408. border: 1px solid #CCCCCC;
  409. font-family: PingFang SC;
  410. font-weight: 500;
  411. font-size: 24rpx;
  412. color: #030303;
  413. margin-left: 20rpx;
  414. }
  415. .bz_item_sel {
  416. width: fit-content;
  417. padding: 14rpx 30rpx;
  418. // height: 71rpx;
  419. background: #FFFFFF;
  420. border-radius: 24rpx;
  421. border: 1px solid #346EF6;
  422. background: #EFF4FF;
  423. font-family: PingFang SC;
  424. font-weight: 500;
  425. font-size: 24rpx;
  426. color: #346EF6;
  427. margin-left: 20rpx;
  428. }
  429. </style>