riderMy.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657
  1. <template>
  2. <view class="bg">
  3. <view class="content">
  4. <!-- <u-navbar :is-back="true" :title="title"></u-navbar> -->
  5. <!-- 顶部 -->
  6. <view class="header">
  7. <!-- #ifdef MP-WEIXIN -->
  8. <view class="head_image">
  9. <button v-if="userId" open-type="chooseAvatar" @chooseavatar="onChooseAvatar" style="background-color: rgba(255, 255, 255, 0) !important;border: none !important;margin-top: 30rpx;">
  10. <image :src="avatar?avatar:'../../static/logo.png'" style="border-radius: 50%;"></image>
  11. </button>
  12. <image v-else :src="avatar?avatar:'../../static/logo.png'" style="border-radius: 50%;"></image>
  13. </view>
  14. <!-- #endif -->
  15. <!-- #ifndef MP-WEIXIN -->
  16. <view class="head_image">
  17. <image v-if="userId" @click="upavatar()" :src="avatar?avatar:'../../static/logo.png'" style="border-radius: 50%;"></image>
  18. <image v-else :src="avatar?avatar:'../../static/logo.png'" style="border-radius: 50%;"></image>
  19. </view>
  20. <!-- #endif -->
  21. <view class="head_name" v-if="userId">
  22. <view class="name" @click="upNickName()">{{nickName}}</view>
  23. <view v-if="XCXIsSelect !='否'">
  24. <view class="approve" v-if="checkCertification=='0'">实名认证审核中</view>
  25. <view class="approve" v-if="checkCertification=='1'">已实名</view>
  26. <view class="approve" @click="bindapprove" v-if="checkCertification=='2'">实名认证未通过</view>
  27. <view class="approve" @click="bindapprove" v-if="checkCertification==null">未实名认证</view>
  28. </view>
  29. </view>
  30. <view class="head_name" v-if="!userId">
  31. <button class="logins" @click="goLogin">登录</button>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 收入和订单 -->
  36. <view style="border-radius: 24rpx;overflow: hidden;width: 93%;margin: 0 auto;background: #ffffff;"
  37. v-if="XCXIsSelect !='否'">
  38. <view class="user_box">
  39. <view class="box">
  40. <view class="user_name">
  41. <u-section title="今日收入" :right="false" line-color="#FE3B27"></u-section>
  42. </view>
  43. <view class="user_price">{{indent.incomeday?indent.incomeday:0}} <text>元</text></view>
  44. <view class="user_tit ">今日收入金额</view>
  45. </view>
  46. <view class="box">
  47. <view class="user_name">
  48. <u-section title="本月收入" :right="false" line-color="#009C66"></u-section>
  49. </view>
  50. <view class="user_price">{{indent.incomemonth?indent.incomemonth:0}} <text>元</text></view>
  51. <view class="user_tit ">本月收入金额</view>
  52. </view>
  53. </view>
  54. <view class="user_box">
  55. <view class="box">
  56. <view class="user_name">
  57. <u-section title="累计收入" :right="false" line-color="#FE3B27"></u-section>
  58. </view>
  59. <view class="user_price">{{indent.incomesum?indent.incomesum:0}} <text>元</text></view>
  60. <view class="user_tit ">累计收入金额</view>
  61. </view>
  62. <view class="box" @click="myOrders()">
  63. <view class="user_name">
  64. <u-section title="订单统计" :right="false" line-color="#009C66"></u-section>
  65. </view>
  66. <view class="user_price">{{indent.indentCount?indent.indentCount:0}} <text>单</text></view>
  67. <view class="user_tit ">今日完成单量</view>
  68. </view>
  69. </view>
  70. </view>
  71. <!-- 我的列表 -->
  72. <view class="mylist">
  73. <view v-if="XCXIsSelect !='否'" class="list_box" v-for="(item,index) in mylist" :key="index"
  74. @click="bindmy(item.name)">
  75. <view class="list_left">
  76. <view class="list_img">
  77. <image :src="item.image" mode="scaleToFill"></image>
  78. </view>
  79. <view class="list_name">{{item.name}}</view>
  80. </view>
  81. <view class="list_right">
  82. <view v-if="item.messageCount" class="bott">{{item.messageCount}}</view>
  83. <image src="../../static/my/icon_go.png"></image>
  84. </view>
  85. </view>
  86. <view v-if="XCXIsSelect =='否'" class="list_box" v-for="(item,index) in datalist" :key="index"
  87. @click="bindmy(item.name)">
  88. <view class="list_left">
  89. <view class="list_img">
  90. <image :src="item.image"></image>
  91. </view>
  92. <view class="list_name">{{item.name}}</view>
  93. </view>
  94. <view class="list_right">
  95. <image src="../../static/my/icon_go.png"></image>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </template>
  101. <script>
  102. import configurl from '../../common/config.js'
  103. export default {
  104. onShareAppMessage(res) { //发送给朋友
  105. return {
  106. title: this.tuiguang,
  107. path: '/pages/index/index',
  108. imageUrl: this.tuiguangImg,
  109. }
  110. },
  111. onShareTimeline(res) { //分享到朋友圈
  112. return {
  113. title: this.tuiguang,
  114. path: '/pages/index/index',
  115. imageUrl: this.tuiguangImg,
  116. }
  117. },
  118. data() {
  119. return {
  120. tuiguang: '',
  121. tuiguangImg: '',
  122. show: false,
  123. title: '我的',
  124. mylist: [
  125. {
  126. id: 1,
  127. name: '我的订单',
  128. image: '../../static/rider/77.png'
  129. },{
  130. id: 2,
  131. name: '资金账户',
  132. image: '../../static/rider/22.png'
  133. },
  134. {
  135. id: 3,
  136. name: '我的评价',
  137. image: '../../static/rider/33.png'
  138. },
  139. {
  140. id: 4,
  141. name: '违规申诉',
  142. image: '../../static/rider/44.png'
  143. },
  144. {
  145. id: 5,
  146. name: '联系客服',
  147. image: '../../static/my/8.png'
  148. }, {
  149. id: 6,
  150. name: '消息中心',
  151. image: '../../static/rider/liaotin.png',
  152. messageCount:''
  153. },
  154. {
  155. id: 7,
  156. name: '意见反馈',
  157. image: '../../static/rider/66.png'
  158. },
  159. {
  160. id: 9,
  161. name: '系统设置',
  162. image: '../../static/rider/55.png'
  163. }
  164. ],
  165. datalist: [{
  166. id: 3,
  167. name: '我的评价',
  168. image: '../../static/rider/33.png'
  169. },
  170. {
  171. id: 4,
  172. name: '违规申诉',
  173. image: '../../static/rider/44.png'
  174. }, {
  175. id: 5,
  176. name: '消息中心',
  177. image: '../../static/rider/liaotin.png'
  178. },
  179. // {
  180. // id: 6,
  181. // name: '用户协议',
  182. // image: '../../static/rider/66.png'
  183. // },
  184. // {
  185. // id: 7,
  186. // name: '隐私政策',
  187. // image: '../../static/rider/77.png'
  188. // },
  189. {
  190. id: 9,
  191. name: '系统设置',
  192. image: '../../static/rider/55.png'
  193. }
  194. ],
  195. information: {}, //个人信息
  196. daySr: '',
  197. orders: '',
  198. indent: {},
  199. avatar: '',
  200. nickName: '匿名',
  201. checkCertification: '',
  202. userId: '',
  203. token: '',
  204. XCXIsSelect: '否',
  205. //messageCount: ''
  206. }
  207. },
  208. onLoad() {
  209. this.$Request.getT('/app/common/type/331').then(res => {
  210. if (res.code === 0) {
  211. uni.setStorageSync('tuiguang', res.data.value)
  212. this.tuiguang = res.data.value
  213. }
  214. });
  215. this.$Request.getT('/app/common/type/332').then(res => {
  216. if (res.code === 0) {
  217. uni.setStorageSync('tuiguangImg', res.data.value)
  218. this.tuiguangImg = res.data.value
  219. }
  220. });
  221. },
  222. onShow() {
  223. this.mylist[5].messageCount = uni.getStorageSync('messageCount')
  224. this.XCXIsSelect = this.$queue.getData('XCXIsSelect');
  225. this.token = this.$queue.getData('token');
  226. this.userId = this.$queue.getData('userId');
  227. if (this.token) {
  228. this.shouru()
  229. this.getUserInfo(this.userId);
  230. } else {
  231. // this.goLogin();
  232. }
  233. },
  234. methods: {
  235. //微信填写能力获取头像
  236. onChooseAvatar(e){
  237. console.log(e.detail.avatarUrl)
  238. let that = this;
  239. let token = uni.getStorageSync('token');
  240. uni.showLoading({
  241. title: '上传中...',
  242. mask: true, // 是否显示透明蒙层,防止触摸穿透
  243. });
  244. uni.uploadFile({
  245. // url: config.APIHOST1 + '/alioss/upload', //仅为示例,非真实的接口地址
  246. url: configurl.APIHOST2+'/alioss/upload', //仅为示例,非真实的接口地址
  247. filePath: e.detail.avatarUrl,
  248. header: {
  249. token: token
  250. },
  251. name: 'file',
  252. success: uploadFileRes => {
  253. let url = JSON.parse(uploadFileRes.data).data;
  254. that.$Request.postJson(
  255. '/app/user/updateUserImageUrl?avatar=' + url).then(
  256. res => {
  257. uni.hideLoading();
  258. if (res.code === 0) {
  259. that.$queue.showToast(
  260. "更新成功");
  261. that.getUserInfo();
  262. }
  263. });
  264. },
  265. fail:res=>{
  266. uni.showToast({
  267. title:res,
  268. icon:'error'
  269. })
  270. }
  271. });
  272. },
  273. //修改用户名
  274. upNickName(){
  275. uni.navigateTo({
  276. url:'./updateNickName'
  277. })
  278. },
  279. //修改用户头像
  280. upavatar() {
  281. let that = this;
  282. var url = null;
  283. let userId = this.$queue.getData('userId');
  284. uni.showActionSheet({
  285. // itemList按钮的文字接受的是数组
  286. itemList: ["查看头像", "从相册选择图片"],
  287. success(e) {
  288. var index = e.tapIndex
  289. if (index === 0) {
  290. // 用户点击了预览当前图片
  291. // 可以自己实现当前头像链接的读取
  292. let url = that.avatar;
  293. let arr = []
  294. arr.push(url)
  295. uni.previewImage({
  296. // 预览功能图片也必须是数组的
  297. urls: arr
  298. })
  299. } else if (index === 1) {
  300. uni.chooseImage({
  301. count: 1, //默认9
  302. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  303. sourceType: ['album'], //从相册选择
  304. success: function(res) {
  305. uni.showLoading({
  306. title: '上传中...',
  307. mask: true, // 是否显示透明蒙层,防止触摸穿透
  308. });
  309. let token = uni.getStorageSync('token');
  310. uni.uploadFile({
  311. // url: config.APIHOST1 + '/alioss/upload', //仅为示例,非真实的接口地址
  312. url: 'https://mxys.chuanghai-tech.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址
  313. filePath: res.tempFilePaths[0],
  314. header: {
  315. token: token
  316. },
  317. name: 'file',
  318. success: uploadFileRes => {
  319. url = JSON.parse(uploadFileRes.data).data;
  320. that.$Request.postJson(
  321. '/app/user/updateUserImageUrl?avatar=' + url).then(
  322. res => {
  323. uni.hideLoading();
  324. if (res.code === 0) {
  325. that.$queue.showToast(
  326. "更新成功");
  327. that.getUserInfo();
  328. }
  329. });
  330. }
  331. });
  332. }
  333. });
  334. }
  335. }
  336. })
  337. },
  338. // 查看今日收入
  339. profit() {
  340. if (!this.userId) {
  341. uni.navigateTo({
  342. url: '/pages/login/login'
  343. })
  344. return
  345. }
  346. uni.navigateTo({
  347. url: '/pages/riderMy/profit'
  348. })
  349. },
  350. // 查看订单统计
  351. myOrders() {
  352. if (!this.userId) {
  353. uni.navigateTo({
  354. url: '/pages/login/login'
  355. })
  356. return
  357. }
  358. uni.navigateTo({
  359. url: '/pages/riderMy/order'
  360. })
  361. },
  362. bindapprove() {
  363. uni.navigateTo({
  364. url: '/pages/riderMy/approve/approve'
  365. })
  366. },
  367. bindmy(name) {
  368. console.log(name)
  369. let that = this
  370. if (!that.token) {
  371. uni.navigateTo({
  372. url: '/pages/login/login'
  373. })
  374. return
  375. }
  376. if (name == '资金账户') {
  377. uni.navigateTo({
  378. url: '/pages/riderMy/myAccount/myAccount'
  379. })
  380. }else if (name == '我的订单') {
  381. uni.navigateTo({
  382. url: '/pages/riderMy/order'
  383. })
  384. } else if (name == '我的评价') {
  385. uni.navigateTo({
  386. url: '/pages/riderMy/myComment/myComment'
  387. })
  388. } else if (name == '联系客服') {
  389. uni.navigateTo({
  390. url: '/pages/riderMy/kefu/chat'
  391. })
  392. } else if (name == '用户协议') {
  393. uni.navigateTo({
  394. url: '/pages/riderMy/xieyi'
  395. })
  396. } else if (name == '隐私政策') {
  397. uni.navigateTo({
  398. url: '/pages/riderMy/mimi'
  399. })
  400. } else if (name == '违规申诉') {
  401. uni.navigateTo({
  402. url: '/pages/riderMy/myComplain/myComplain'
  403. })
  404. } else if (name == '培训中心') {
  405. uni.navigateTo({
  406. url: '/pages/riderMy/trainingList'
  407. })
  408. } else if (name == '消息中心') {
  409. uni.navigateTo({
  410. url: '/pages/riderMy/kefu/liaotian'
  411. })
  412. } else if (name == '系统设置') {
  413. uni.navigateTo({
  414. url: '/pages/riderMy/set/set'
  415. })
  416. } else if (name == '意见反馈') {
  417. uni.navigateTo({
  418. url: '/pages/riderMy/set/yijian'
  419. })
  420. }
  421. },
  422. //检测是否登录
  423. checkLogin() {
  424. },
  425. // 获取个人信息
  426. getUserInfo(userId) {
  427. this.$Request.getT("/app/tbindent/findUserInfoById").then(res => {
  428. if (res.code == 0) {
  429. this.$nextTick(function() {
  430. this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
  431. this.nickName = res.data.nickName
  432. uni.setStorageSync('userName',res.data.userName)
  433. uni.setStorageSync('phone',res.data.phone)
  434. this.checkCertification = res.data.checkCertification
  435. console.log(this.checkCertification, '实名认证')
  436. this.userId = res.data.userId
  437. })
  438. } else {
  439. this.$queue.logout();
  440. uni.showModal({
  441. showCancel: false,
  442. title: '登录失败',
  443. content: res.msg,
  444. });
  445. }
  446. });
  447. },
  448. // 今日收入、订单量
  449. shouru() {
  450. this.$Request.getT('/app/userinfo/findIncome').then(res => {
  451. if (res.code == 0) {
  452. // this.daySr = res.data.income
  453. // this.orders = res.data.indentCount
  454. this.indent = res.data
  455. }
  456. console.log('res', res)
  457. });
  458. },
  459. // 跳转去登录
  460. goLogin() {
  461. // this.$queue.setData('href', '/pages/my/index');
  462. uni.navigateTo({
  463. url: '/pages/login/login'
  464. });
  465. },
  466. }
  467. }
  468. </script>
  469. <style>
  470. button::after {
  471. border: none;
  472. /* background-color: none; */
  473. }
  474. .u-icon__icon {
  475. font-size: 35rpx !important;
  476. font-weight: bold !important;
  477. }
  478. .u-title {
  479. color: #000000 !important;
  480. }
  481. .u-navbar-fixed {
  482. background: none !important;
  483. }
  484. body {
  485. background: #F5F5F5;
  486. }
  487. .bg {}
  488. .logins {
  489. border: none;
  490. background: #F8501F;
  491. color: #fff;
  492. width: 200rpx;
  493. margin: 70rpx 20rpx;
  494. height: 70rpx;
  495. line-height: 70rpx;
  496. }
  497. .content {
  498. background: linear-gradient(0deg, #F5F5F5 0%, #fed9ba 100%);
  499. width: 100%;
  500. }
  501. /* 顶部 */
  502. .header {
  503. width: 100%;
  504. height: 200rpx;
  505. display: flex;
  506. }
  507. .head_image {
  508. flex: 1;
  509. display: flex;
  510. justify-content: center;
  511. align-items: center;
  512. }
  513. .head_image image {
  514. width: 90rpx;
  515. height: 90rpx;
  516. }
  517. .head_name {
  518. flex: 4;
  519. position: relative;
  520. margin-left: -14rpx;
  521. }
  522. .name {
  523. position: absolute;
  524. top: 65rpx;
  525. }
  526. .approve {
  527. position: absolute;
  528. top: 100rpx;
  529. font-size: 24rpx;
  530. color: #999999;
  531. }
  532. /* 用户信息 */
  533. .user_box {
  534. display: flex;
  535. height: 210rpx;
  536. position: relative;
  537. top: -15rpx;
  538. padding: 0 20rpx;
  539. }
  540. .box {
  541. flex: 1;
  542. /* margin-left: 40rpx; */
  543. margin-top: 40rpx;
  544. }
  545. .user_price {
  546. font-size: 44rpx;
  547. margin-top: 10rpx;
  548. }
  549. .user_price text {
  550. font-size: 21rpx;
  551. margin-left: 10rpx;
  552. }
  553. .user_tit {
  554. color: #B3B3B3;
  555. font-size: 21rpx;
  556. margin-top: 10rpx;
  557. }
  558. .u-section__title {
  559. font-weight: 500 !important;
  560. color: #333333 !important;
  561. font-size: 14px !important;
  562. padding-left: 10px;
  563. }
  564. /* 我的列表 */
  565. .mylist {
  566. width: 93%;
  567. margin: 0 auto;
  568. background-color: #FFFFFF;
  569. margin-top: 10rpx;
  570. border-radius: 23rpx;
  571. }
  572. .list_box {
  573. width: 90%;
  574. margin: 0 auto;
  575. display: flex;
  576. height: 95rpx;
  577. }
  578. .list_left {
  579. flex: 1;
  580. display: flex;
  581. justify-content: left;
  582. align-items: center;
  583. }
  584. .list_img {
  585. margin-right: 10rpx;
  586. margin-top: 10rpx;
  587. }
  588. .list_img image {
  589. width: 32rpx;
  590. height: 32rpx;
  591. }
  592. .list_name {
  593. font-size: 25rpx;
  594. letter-spacing: 2rpx;
  595. }
  596. .list_right {
  597. flex: 1;
  598. display: flex;
  599. justify-content: flex-end;
  600. align-items: center;
  601. }
  602. .list_right image {
  603. width: 12rpx;
  604. height: 20rpx;
  605. }
  606. .bott {
  607. background: red;
  608. color: #ffffff;
  609. padding: 5rpx 10rpx;
  610. border-radius: 60%;
  611. font-size: 23rpx;
  612. margin-right: 15rpx;
  613. }
  614. </style>