tdSet.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447
  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 src="/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. export default {
  106. data() {
  107. return {
  108. address: '',
  109. musicType: 2,
  110. driverId: '',
  111. dxSel: 1,
  112. timeNum: 4,
  113. snShow: true,
  114. kcShow: true,
  115. current: 3,
  116. list: [{
  117. name: '1'
  118. },
  119. {
  120. name: '2'
  121. },
  122. {
  123. name: '3'
  124. },
  125. {
  126. name: '4'
  127. }
  128. ],
  129. hcNum: 100,
  130. driverPlate: '',
  131. friendsType: 2,
  132. shangxian: '是'
  133. }
  134. },
  135. onLoad() {
  136. this.shangxian = uni.getStorageSync('shangxian')
  137. if (this.shangxian === '否') {
  138. uni.setNavigationBarTitle({
  139. title: '听单设置'
  140. })
  141. }
  142. this.getDetail();
  143. this.getAddress();
  144. },
  145. methods: {
  146. getAddress() {
  147. let that = this;
  148. that.$queue.showLoading('刷新中...')
  149. uni.getLocation({
  150. // #ifdef APP
  151. type: 'wgs84',
  152. // #endif
  153. // #ifndef APP
  154. type: 'gcj02', //wgs84 gcj02
  155. // #endif
  156. success: function(res) {
  157. console.log(res, '获取经纬度')
  158. let data = {
  159. lat: res.latitude,
  160. lng: res.longitude
  161. }
  162. that.$Request.getT('/app/Login/selectCity', data).then(res => {
  163. uni.hideLoading();
  164. if (res.code === 0 && res.data) {
  165. that.address = res.data.address
  166. }
  167. });
  168. },
  169. fail: function(ree) {
  170. uni.hideLoading();
  171. }
  172. });
  173. },
  174. currentSel(e) {
  175. this.current = e;
  176. },
  177. saveSet() {
  178. let latitude = uni.getStorageSync('latitude')
  179. let longitude = uni.getStorageSync('longitude')
  180. let city = uni.getStorageSync('cityName')
  181. let startTime = ''
  182. if (this.timeNum == 1) {
  183. startTime = '15分钟内'
  184. } else if (this.timeNum == 2) {
  185. startTime = '30分钟内'
  186. } else if (this.timeNum == 3) {
  187. startTime = '60分钟内'
  188. } else if (this.timeNum == 4) {
  189. startTime = '全天'
  190. }
  191. let data = {
  192. driverId: this.driverId,
  193. latitude: latitude,
  194. longitude: longitude,
  195. city: city,
  196. seatNum: this.current + 1,
  197. isFriends: this.friendsType,
  198. musicType: this.musicType,
  199. isCityOrders: this.snShow ? 1 : 0,
  200. isProvinceOrders: this.kcShow ? 1 : 0,
  201. ordersKm: this.hcNum / 10,
  202. ordersStartTime: startTime,
  203. ordersType: this.dxSel,
  204. }
  205. let that = this;
  206. uni.showModal({
  207. title: '温馨提示',
  208. content: '确认保存听单设置吗?',
  209. showCancel: true,
  210. cancelText: '取消',
  211. confirmText: '确认',
  212. success: red => {
  213. if (red.confirm) {
  214. that.$queue.showLoading('保存中...')
  215. that.$Request.postJson('/app/driver/updateDriver', data).then(res => {
  216. uni.hideLoading();
  217. if (res.code == 0) {
  218. that.$queue.showToast('保存成功!')
  219. setTimeout(d => {
  220. uni.navigateBack();
  221. }, 1500)
  222. } else {
  223. that.$queue.showToast(res.msg)
  224. }
  225. });
  226. }
  227. }
  228. });
  229. },
  230. mrClick() {
  231. this.dxSel = 1;
  232. this.musicType = 2;
  233. this.timeNum = 4;
  234. this.snShow = true;
  235. this.kcShow = true;
  236. this.current = 3;
  237. this.hcNum = 100;
  238. this.friendsType = 2;
  239. },
  240. checkBZDX(index) {
  241. this.dxSel = index;
  242. },
  243. checkBZSJ(index) {
  244. this.timeNum = index;
  245. },
  246. checkBZYY(index) {
  247. this.musicType = index;
  248. },
  249. checkBZQY(index) {
  250. this.friendsType = index;
  251. },
  252. getDetail() {
  253. let userId = this.$queue.getData('userId');
  254. this.$Request.getT('/app/driver/selectDriverByUserId?userId=' + userId).then(res => {
  255. if (res.code == 0 && res.data) {
  256. this.driverPlate = res.data.driverPlate
  257. this.driverId = res.data.driverId
  258. if (res.data.seatNum) {
  259. this.current = parseInt(res.data.seatNum) - 1
  260. }
  261. if (res.data.isFriends) {
  262. this.friendsType = res.data.isFriends
  263. }
  264. if (res.data.isCityOrders) {
  265. this.snShow = res.data.isCityOrders == 1 ? true : false
  266. }
  267. if (res.data.musicType) {
  268. this.musicType = res.data.musicType;
  269. }
  270. if (res.data.isProvinceOrders) {
  271. this.kcShow = res.data.isProvinceOrders == 1 ? true : false
  272. }
  273. if (res.data.ordersKm) {
  274. this.hcNum = parseInt(res.data.ordersKm) * 10
  275. }
  276. if (res.data.ordersStartTime) {
  277. // this.current = res.data.ordersStartTime
  278. if (res.data.ordersStartTime === '15分钟内') {
  279. this.timeNum = 1
  280. } else if (res.data.ordersStartTime === '30分钟内') {
  281. this.timeNum = 2
  282. } else if (res.data.ordersStartTime === '60分钟内') {
  283. this.timeNum = 3
  284. } else if (res.data.ordersStartTime === '全天') {
  285. this.timeNum = 4
  286. }
  287. }
  288. if (res.data.ordersType) {
  289. this.dxSel = res.data.ordersType
  290. }
  291. }
  292. })
  293. }
  294. }
  295. }
  296. </script>
  297. <style lang="scss">
  298. page {
  299. background: #F5F5F5;
  300. }
  301. .mr_btn {
  302. width: 214rpx;
  303. height: 98rpx;
  304. background: #FFFFFF;
  305. border-radius: 32rpx;
  306. border: 1px solid #999999;
  307. text-align: center;
  308. line-height: 98rpx;
  309. font-family: PingFang SC;
  310. font-weight: bold;
  311. font-size: 32rpx;
  312. color: #161616;
  313. }
  314. .save_btn {
  315. width: 444rpx;
  316. height: 98rpx;
  317. background: #346EF6;
  318. border-radius: 32rpx;
  319. text-align: center;
  320. line-height: 98rpx;
  321. font-family: PingFang SC;
  322. font-weight: bold;
  323. font-size: 32rpx;
  324. color: #FFFFFF;
  325. margin-left: 30rpx;
  326. }
  327. .item_view {
  328. width: 694rpx;
  329. background: #FFFFFF;
  330. border-radius: 32rpx;
  331. margin: 30rpx;
  332. padding: 30rpx;
  333. .item_title {
  334. font-family: Source Han Sans CN;
  335. font-weight: 800;
  336. font-size: 30rpx;
  337. color: #333333;
  338. }
  339. .item_kuang {
  340. width: 637rpx;
  341. height: 88rpx;
  342. background: #FFFFFF;
  343. border-radius: 24rpx;
  344. border: 1px solid #CCCCCC;
  345. align-items: center;
  346. padding: 30rpx;
  347. margin-top: 20rpx;
  348. display: flex;
  349. justify-content: space-between;
  350. }
  351. .item_name {
  352. font-family: PingFang SC;
  353. font-weight: 500;
  354. font-size: 26rpx;
  355. color: #030303;
  356. }
  357. }
  358. .btn_view{
  359. width: 750rpx;
  360. position: fixed;
  361. bottom: 0;
  362. display: flex;
  363. justify-content: space-between;
  364. padding: 30rpx;
  365. background: #FFFFFF;
  366. }
  367. .sj_item {
  368. width: 140rpx;
  369. padding: 20rpx 0rpx;
  370. text-align: center;
  371. // height: 71rpx;
  372. background: #FFFFFF;
  373. border-radius: 24rpx;
  374. border: 1px solid #CCCCCC;
  375. font-family: PingFang SC;
  376. font-weight: 500;
  377. font-size: 24rpx;
  378. color: #030303;
  379. margin-right: 20rpx;
  380. }
  381. .sj_item_sel {
  382. width: 140rpx;
  383. padding: 20rpx 0rpx;
  384. text-align: center;
  385. // height: 71rpx;
  386. background: #FFFFFF;
  387. border-radius: 24rpx;
  388. border: 1px solid #346EF6;
  389. background: #EFF4FF;
  390. font-family: PingFang SC;
  391. font-weight: 500;
  392. font-size: 24rpx;
  393. color: #346EF6;
  394. margin-right: 20rpx;
  395. }
  396. .bz_item {
  397. width: fit-content;
  398. padding: 14rpx 30rpx;
  399. // height: 71rpx;
  400. background: #FFFFFF;
  401. border-radius: 24rpx;
  402. border: 1px solid #CCCCCC;
  403. font-family: PingFang SC;
  404. font-weight: 500;
  405. font-size: 24rpx;
  406. color: #030303;
  407. margin-left: 20rpx;
  408. }
  409. .bz_item_sel {
  410. width: fit-content;
  411. padding: 14rpx 30rpx;
  412. // height: 71rpx;
  413. background: #FFFFFF;
  414. border-radius: 24rpx;
  415. border: 1px solid #346EF6;
  416. background: #EFF4FF;
  417. font-family: PingFang SC;
  418. font-weight: 500;
  419. font-size: 24rpx;
  420. color: #346EF6;
  421. margin-left: 20rpx;
  422. }
  423. </style>