riderMy.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654
  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. });
  243. uni.uploadFile({
  244. // url: config.APIHOST1 + '/alioss/upload', //仅为示例,非真实的接口地址
  245. url: configurl.APIHOST2+'/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址
  246. filePath: e.detail.avatarUrl,
  247. header: {
  248. token: token
  249. },
  250. name: 'file',
  251. success: uploadFileRes => {
  252. let url = JSON.parse(uploadFileRes.data).data;
  253. that.$Request.postJson(
  254. '/app/user/updateUserImageUrl?avatar=' + url).then(
  255. res => {
  256. uni.hideLoading();
  257. if (res.code === 0) {
  258. that.$queue.showToast(
  259. "更新成功");
  260. that.getUserInfo();
  261. }
  262. });
  263. },
  264. fail:res=>{
  265. uni.showToast({
  266. title:res,
  267. icon:'error'
  268. })
  269. }
  270. });
  271. },
  272. //修改用户名
  273. upNickName(){
  274. uni.navigateTo({
  275. url:'./updateNickName'
  276. })
  277. },
  278. //修改用户头像
  279. upavatar() {
  280. let that = this;
  281. var url = null;
  282. let userId = this.$queue.getData('userId');
  283. uni.showActionSheet({
  284. // itemList按钮的文字接受的是数组
  285. itemList: ["查看头像", "从相册选择图片"],
  286. success(e) {
  287. var index = e.tapIndex
  288. if (index === 0) {
  289. // 用户点击了预览当前图片
  290. // 可以自己实现当前头像链接的读取
  291. let url = that.avatar;
  292. let arr = []
  293. arr.push(url)
  294. uni.previewImage({
  295. // 预览功能图片也必须是数组的
  296. urls: arr
  297. })
  298. } else if (index === 1) {
  299. uni.chooseImage({
  300. count: 1, //默认9
  301. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  302. sourceType: ['album'], //从相册选择
  303. success: function(res) {
  304. uni.showLoading({
  305. title: '上传中...'
  306. });
  307. let token = uni.getStorageSync('token');
  308. uni.uploadFile({
  309. // url: config.APIHOST1 + '/alioss/upload', //仅为示例,非真实的接口地址
  310. url: 'https://www.daweilinli.com/sqx_fast/alioss/upload', //仅为示例,非真实的接口地址
  311. filePath: res.tempFilePaths[0],
  312. header: {
  313. token: token
  314. },
  315. name: 'file',
  316. success: uploadFileRes => {
  317. url = JSON.parse(uploadFileRes.data).data;
  318. that.$Request.postJson(
  319. '/app/user/updateUserImageUrl?avatar=' + url).then(
  320. res => {
  321. uni.hideLoading();
  322. if (res.code === 0) {
  323. that.$queue.showToast(
  324. "更新成功");
  325. that.getUserInfo();
  326. }
  327. });
  328. }
  329. });
  330. }
  331. });
  332. }
  333. }
  334. })
  335. },
  336. // 查看今日收入
  337. profit() {
  338. if (!this.userId) {
  339. uni.navigateTo({
  340. url: '/pages/login/login'
  341. })
  342. return
  343. }
  344. uni.navigateTo({
  345. url: '/pages/riderMy/profit'
  346. })
  347. },
  348. // 查看订单统计
  349. myOrders() {
  350. if (!this.userId) {
  351. uni.navigateTo({
  352. url: '/pages/login/login'
  353. })
  354. return
  355. }
  356. uni.navigateTo({
  357. url: '/pages/riderMy/order'
  358. })
  359. },
  360. bindapprove() {
  361. uni.navigateTo({
  362. url: '/pages/riderMy/approve/approve'
  363. })
  364. },
  365. bindmy(name) {
  366. console.log(name)
  367. let that = this
  368. if (!that.token) {
  369. uni.navigateTo({
  370. url: '/pages/login/login'
  371. })
  372. return
  373. }
  374. if (name == '资金账户') {
  375. uni.navigateTo({
  376. url: '/pages/riderMy/myAccount/myAccount'
  377. })
  378. }else if (name == '我的订单') {
  379. uni.navigateTo({
  380. url: '/pages/riderMy/order'
  381. })
  382. } else if (name == '我的评价') {
  383. uni.navigateTo({
  384. url: '/pages/riderMy/myComment/myComment'
  385. })
  386. } else if (name == '联系客服') {
  387. uni.navigateTo({
  388. url: '/pages/riderMy/kefu/chat'
  389. })
  390. } else if (name == '用户协议') {
  391. uni.navigateTo({
  392. url: '/pages/riderMy/xieyi'
  393. })
  394. } else if (name == '隐私政策') {
  395. uni.navigateTo({
  396. url: '/pages/riderMy/mimi'
  397. })
  398. } else if (name == '违规申诉') {
  399. uni.navigateTo({
  400. url: '/pages/riderMy/myComplain/myComplain'
  401. })
  402. } else if (name == '培训中心') {
  403. uni.navigateTo({
  404. url: '/pages/riderMy/trainingList'
  405. })
  406. } else if (name == '消息中心') {
  407. uni.navigateTo({
  408. url: '/pages/riderMy/kefu/liaotian'
  409. })
  410. } else if (name == '系统设置') {
  411. uni.navigateTo({
  412. url: '/pages/riderMy/set/set'
  413. })
  414. } else if (name == '意见反馈') {
  415. uni.navigateTo({
  416. url: '/pages/riderMy/set/yijian'
  417. })
  418. }
  419. },
  420. //检测是否登录
  421. checkLogin() {
  422. },
  423. // 获取个人信息
  424. getUserInfo(userId) {
  425. this.$Request.getT("/app/tbindent/findUserInfoById").then(res => {
  426. if (res.code == 0) {
  427. this.$nextTick(function() {
  428. this.avatar = res.data.avatar ? res.data.avatar : '../../static/logo.png'
  429. this.nickName = res.data.nickName
  430. uni.setStorageSync('userName',res.data.userName)
  431. this.checkCertification = res.data.checkCertification
  432. console.log(this.checkCertification, '实名认证')
  433. this.userId = res.data.userId
  434. })
  435. } else {
  436. this.$queue.logout();
  437. uni.showModal({
  438. showCancel: false,
  439. title: '登录失败',
  440. content: res.msg,
  441. });
  442. }
  443. });
  444. },
  445. // 今日收入、订单量
  446. shouru() {
  447. this.$Request.getT('/app/userinfo/findIncome').then(res => {
  448. if (res.code == 0) {
  449. // this.daySr = res.data.income
  450. // this.orders = res.data.indentCount
  451. this.indent = res.data
  452. }
  453. console.log('res', res)
  454. });
  455. },
  456. // 跳转去登录
  457. goLogin() {
  458. // this.$queue.setData('href', '/pages/my/index');
  459. uni.navigateTo({
  460. url: '/pages/login/login'
  461. });
  462. },
  463. }
  464. }
  465. </script>
  466. <style>
  467. button::after {
  468. border: none;
  469. /* background-color: none; */
  470. }
  471. .u-icon__icon {
  472. font-size: 35rpx !important;
  473. font-weight: bold !important;
  474. }
  475. .u-title {
  476. color: #000000 !important;
  477. }
  478. .u-navbar-fixed {
  479. background: none !important;
  480. }
  481. body {
  482. background: #F5F5F5;
  483. }
  484. .bg {}
  485. .logins {
  486. border: none;
  487. background: #F8501F;
  488. color: #fff;
  489. width: 200rpx;
  490. margin: 70rpx 20rpx;
  491. height: 70rpx;
  492. line-height: 70rpx;
  493. }
  494. .content {
  495. background: linear-gradient(0deg, #F5F5F5 0%, #fed9ba 100%);
  496. width: 100%;
  497. }
  498. /* 顶部 */
  499. .header {
  500. width: 100%;
  501. height: 200rpx;
  502. display: flex;
  503. }
  504. .head_image {
  505. flex: 1;
  506. display: flex;
  507. justify-content: center;
  508. align-items: center;
  509. }
  510. .head_image image {
  511. width: 90rpx;
  512. height: 90rpx;
  513. }
  514. .head_name {
  515. flex: 4;
  516. position: relative;
  517. margin-left: -14rpx;
  518. }
  519. .name {
  520. position: absolute;
  521. top: 65rpx;
  522. }
  523. .approve {
  524. position: absolute;
  525. top: 100rpx;
  526. font-size: 24rpx;
  527. color: #999999;
  528. }
  529. /* 用户信息 */
  530. .user_box {
  531. display: flex;
  532. height: 210rpx;
  533. position: relative;
  534. top: -15rpx;
  535. padding: 0 20rpx;
  536. }
  537. .box {
  538. flex: 1;
  539. /* margin-left: 40rpx; */
  540. margin-top: 40rpx;
  541. }
  542. .user_price {
  543. font-size: 44rpx;
  544. margin-top: 10rpx;
  545. }
  546. .user_price text {
  547. font-size: 21rpx;
  548. margin-left: 10rpx;
  549. }
  550. .user_tit {
  551. color: #B3B3B3;
  552. font-size: 21rpx;
  553. margin-top: 10rpx;
  554. }
  555. .u-section__title {
  556. font-weight: 500 !important;
  557. color: #333333 !important;
  558. font-size: 14px !important;
  559. padding-left: 10px;
  560. }
  561. /* 我的列表 */
  562. .mylist {
  563. width: 93%;
  564. margin: 0 auto;
  565. background-color: #FFFFFF;
  566. margin-top: 10rpx;
  567. border-radius: 23rpx;
  568. }
  569. .list_box {
  570. width: 90%;
  571. margin: 0 auto;
  572. display: flex;
  573. height: 95rpx;
  574. }
  575. .list_left {
  576. flex: 1;
  577. display: flex;
  578. justify-content: left;
  579. align-items: center;
  580. }
  581. .list_img {
  582. margin-right: 10rpx;
  583. margin-top: 10rpx;
  584. }
  585. .list_img image {
  586. width: 32rpx;
  587. height: 32rpx;
  588. }
  589. .list_name {
  590. font-size: 25rpx;
  591. letter-spacing: 2rpx;
  592. }
  593. .list_right {
  594. flex: 1;
  595. display: flex;
  596. justify-content: flex-end;
  597. align-items: center;
  598. }
  599. .list_right image {
  600. width: 12rpx;
  601. height: 20rpx;
  602. }
  603. .bott {
  604. background: red;
  605. color: #ffffff;
  606. padding: 5rpx 10rpx;
  607. border-radius: 60%;
  608. font-size: 23rpx;
  609. margin-right: 15rpx;
  610. }
  611. </style>