account.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661
  1. <template>
  2. <view class="container">
  3. <!-- 个人信息 -->
  4. <view class="user">
  5. <view class="nav-bar">
  6. <u-navbar bgColor="rgba(0,0,0,0)" :autoBack="false" :placeholder="true">
  7. <view slot="left" style="color:#fff;font-size: 36rpx;">
  8. 我的
  9. </view>
  10. </u-navbar>
  11. </view>
  12. <view class="user-content flex align-center flex-start">
  13. <view class="head-img" @click="userDetail">
  14. <image src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/head-exam.png"
  15. mode="widthFix">
  16. </image>
  17. </view>
  18. <view class="user-name" @click="searchLog(2)">
  19. {{info.name}}
  20. </view>
  21. <view class="share" @share="share">
  22. <view class="share-image">
  23. <image src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/fx.png"
  24. mode="widthFix">
  25. </image>
  26. </view>
  27. <button open-type="share"></button>
  28. </view>
  29. <view class="login-out" @click="setting">
  30. 设置
  31. </view>
  32. </view>
  33. </view>
  34. <!-- 用户信息 -->
  35. <view class="menu menu-userinfo">
  36. <!-- <view class="menu-title">
  37. 用户信息
  38. </view> -->
  39. <view class="u-content">
  40. <view class="u-item flex align-center flex-direction" @click="searchLog(1)">
  41. <view class="u-name">
  42. {{info.mercName}}
  43. </view>
  44. <view class="u-val">
  45. <image src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/sh.png"
  46. mode="widthFix"></image>
  47. 商户
  48. </view>
  49. </view>
  50. <view class="u-item">
  51. <view class="u-name">
  52. {{info.roleNames}}
  53. </view>
  54. <view class="u-val">
  55. <image src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/js.png"
  56. mode="widthFix"></image>
  57. 角色
  58. </view>
  59. </view>
  60. <view class="u-item">
  61. <view class="u-name">
  62. {{info.tel}}
  63. </view>
  64. <view class="u-val">
  65. <image src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/dh.png"
  66. mode="widthFix"></image>
  67. 电话
  68. </view>
  69. </view>
  70. </view>
  71. <!-- <xbutton class="edit" size="mini" @click="btnClick('编辑')">修改</xbutton> -->
  72. </view>
  73. <!-- <view class="menu">
  74. <view class="menu-title">
  75. 系统参数设置
  76. </view>
  77. <view class="s-content">
  78. <view class="s-item">
  79. 自动处理未上架订单:<text>是</text>
  80. </view>
  81. <view class="s-item">
  82. 开启预定模式:<text>是</text>
  83. </view>
  84. <view class="s-item">
  85. 是否强制盘点:<text>是</text>
  86. </view>
  87. </view>
  88. <xbutton class="edit" size="mini" @click="btnClick('编辑')">修改</xbutton>
  89. </view> -->
  90. <!--团队角色管理 -->
  91. <view class="menu convenient" v-if="roleManageMenu.length>0">
  92. <!--<view class="menu-title">
  93. 团队角色管理
  94. </view> -->
  95. <view v-if="roleManageMenu.length>0" class="flex flex-wrap justify-start">
  96. <view class="menu-item" v-for="(item,index) in roleManageMenu" :key="item.id" @click="menuClick(item)">
  97. <view class="image">
  98. <u-image width="74rpx" height="74rpx" :src="iconList[item.name]" mode="widthFix"
  99. :lazy-load="true"></u-image>
  100. </view>
  101. <view>{{item.name}}</view>
  102. </view>
  103. </view>
  104. <view class="empty" v-else>
  105. <u-empty mode="permission"></u-empty>
  106. </view>
  107. </view>
  108. <!--应用管理 -->
  109. <view class="menu convenient" v-if="costManageMenu.length>0">
  110. <!-- <view class="menu-title">
  111. 费用/提现管理
  112. </view> -->
  113. <view v-if="costManageMenu.length>0" class="flex flex-wrap justify-start">
  114. <view class="menu-item" v-for="(item,index) in costManageMenu" :key="item.id" @click="menuClick(item)">
  115. <view class="image">
  116. <u-image width="74rpx" height="74rpx" :src="iconList[item.name]" mode="widthFix"
  117. :lazy-load="true"></u-image>
  118. </view>
  119. <view>{{item.name}}</view>
  120. </view>
  121. </view>
  122. <view class="empty" v-else>
  123. <u-empty mode="permission"></u-empty>
  124. </view>
  125. </view>
  126. <!-- <view class="chang-password" @click="changePwd">
  127. 修改密码
  128. </view> -->
  129. <xpopup :show="qrcodeShow" mode="center" @close="qrcodeClose" :showBtn="false">
  130. <view class="qrcode-content flex flex-direction align-center">
  131. <view class="qrcode-img">
  132. <u-image width="400rpx" height="400rpx"
  133. src="https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/miniQrcode.jpg"
  134. mode="widthFix" :lazy-load="true">
  135. </u-image>
  136. </view>
  137. <view class="save-qrcode" slot="botton">
  138. <xbutton @click="save">保存二维码</xbutton>
  139. </view>
  140. </view>
  141. </xpopup>
  142. <xpopup :show="pwdShow" @close="pwdClose" @confirm="pwdSubmit" :showBtn="true" title="修改密码">
  143. <view class="pwd-popup-content flex align-center">
  144. <view>新密码:</view>
  145. <view>
  146. <u--input placeholder="请输入新密码" type="password" border="surround" v-model="newpassword"></u--input>
  147. </view>
  148. </view>
  149. </xpopup>
  150. </view>
  151. </template>
  152. <script>
  153. import {
  154. removeToken
  155. } from '@/utils/auth'
  156. // import Xypopup from '@/components/xy-popup'
  157. import {
  158. userInfo,
  159. updateUserInfo
  160. } from "@/api/system/user.js"
  161. export default {
  162. // components: {
  163. // Xypopup
  164. // },
  165. data() {
  166. return {
  167. tabArr: [{
  168. name: '今日',
  169. id: 0
  170. },
  171. {
  172. name: '本月',
  173. id: 1
  174. }
  175. ],
  176. current: 0,
  177. //菜单对应图片路径
  178. iconList: {
  179. '退款审核': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/refund.png',
  180. '风险订单': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/risk.png',
  181. '客诉处理': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/cc.png',
  182. '补货管理': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/replenishment.png',
  183. '增加设备': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/menu-icon (9).png',
  184. '增加点位': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/menu-icon (8).png',
  185. '团队管理': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/tdgl.png',
  186. '加盟商': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/jms.png',
  187. '流量卡管理': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/menu-icon (5).png',
  188. '会员管理': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/hygl.png',
  189. '运营仓': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/menu-icon (7).png',
  190. '黑名单': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/hmd.png',
  191. '营销管理': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/menu-icon (6).png',
  192. '费用账单': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/home/menu-icon (10).png',
  193. '小程序二维码': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/xcxewm.png',
  194. '通知': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/tz.png',
  195. '客服': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/kf.png',
  196. '入驻协议': 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/rzxy.png',
  197. },
  198. info: {
  199. mercName: "",
  200. name: "sunny",
  201. roleNames: "",
  202. tel: ""
  203. },
  204. timer: null,
  205. logNum: 0,
  206. qrcodeShow: false,
  207. newpassword: '',
  208. pwdShow: false,
  209. }
  210. },
  211. computed: {
  212. //团队角色管理
  213. roleManageMenu() {
  214. return this.getMenu('我的', '团队角色管理')
  215. },
  216. //应用管理
  217. costManageMenu() {
  218. return this.getMenu('我的', '应用管理')
  219. },
  220. //用户名
  221. name() {
  222. return this.$store.state.user.name
  223. },
  224. },
  225. onShareAppMessage() {
  226. return {
  227. title: '喵星人商家助手',
  228. path: '/pages/login',
  229. imageUrl: 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/merc_qrcode.jpg',
  230. success: function(res) {
  231. // 转发成功之后的回调
  232. if (res.errMsg == 'shareAppMessage:ok') {
  233. }
  234. },
  235. fail: function() {
  236. // 转发失败之后的回调
  237. if (res.errMsg == 'shareAppMessage:fail cancel') {
  238. // 用户取消转发
  239. } else if (res.errMsg == 'shareAppMessage:fail') {
  240. // 转发失败,其中 detail message 为详细失败信息
  241. }
  242. },
  243. }
  244. },
  245. created() {
  246. this.getUserInfo()
  247. },
  248. methods: {
  249. searchLog(type) {
  250. this.logNum++
  251. if (this.timer) {
  252. if (this.logNum > 6) {
  253. this.logNum = 0
  254. clearTimeout(this.timer)
  255. this.timer = null
  256. let url=type==1?'/pages/globalPages/logs':'/pages/globalPages/test'
  257. this.$tab.navigateTo(url)
  258. }
  259. } else {
  260. this.timer = setTimeout(() => {
  261. this.logNum = 0
  262. clearTimeout(this.timer)
  263. this.timer = null
  264. }, 2000)
  265. }
  266. },
  267. getUserInfo() {
  268. userInfo().then(res => {
  269. if (res.code == 200) {
  270. this.info = res.data
  271. } else {
  272. this.info = null
  273. }
  274. })
  275. },
  276. getMenu(menu1, menu2) {
  277. let menu = []
  278. if (this.$store.state.permission.permissions_menu && this.$store.state.permission.permissions_menu !=
  279. '[]') {
  280. let allMenu = JSON.parse(this.$store.state.permission.permissions_menu);
  281. if (allMenu.find(i => i.name == menu1) && allMenu.find(i => i.name == menu1).children) {
  282. let homeMenu = allMenu.find(i => i.name == menu1).children;
  283. if (homeMenu.find(i => i.name == menu2)) {
  284. if (homeMenu.find(i => i.name == menu2).children) {
  285. menu = homeMenu.find(i => i.name == menu2).children
  286. }
  287. }
  288. }
  289. }
  290. return menu
  291. },
  292. btnClick(e) {
  293. },
  294. menuClick(e) {
  295. if (e.name == '团队管理') {
  296. this.$tab.navigateTo('/pages/system/employee')
  297. return
  298. }
  299. if (e.name == '小程序二维码') {
  300. this.qrcodeShow = true;
  301. return
  302. }
  303. if (e.name == '通知') {
  304. this.$tab.navigateTo('/pages/globalPages/notice')
  305. return
  306. }
  307. if (e.name == '客服') {
  308. this.phone('88888888')
  309. return
  310. }
  311. if (e.name == '入驻协议') {
  312. this.$tab.navigateTo('/pages/globalPages/agreement')
  313. return
  314. }
  315. this.$modal.msg('功能开发中,尽请期待~')
  316. },
  317. loginOut() {
  318. this.$store.dispatch('LogOut').then(res => {
  319. this.$tab.reLaunch('/pages/login')
  320. })
  321. },
  322. qrcodeClose() {
  323. this.qrcodeShow = false;
  324. },
  325. save() {
  326. let imgUrl = 'https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/miniQrcode.jpg'
  327. wx.getSetting({
  328. success: function(res) {
  329. if (!res.authSetting['scope.writePhotosAlbum']) { //判断是否开启相册权限
  330. uni.authorize({
  331. scope: 'scope.writePhotosAlbum',
  332. success: function(res) {
  333. uni.downloadFile({
  334. url: imgUrl,
  335. success: function(res) {
  336. uni.saveImageToPhotosAlbum({
  337. filePath: res.tempFilePath,
  338. success: function(res) {
  339. wx.showToast({
  340. title: '保存成功',
  341. })
  342. }
  343. })
  344. }
  345. })
  346. },
  347. fail(res) {
  348. uni.showModal({
  349. title: '提示',
  350. content: '您未开启保存图片到相册的权限,请点击确定去开启权限!',
  351. success(res) {
  352. if (res.confirm) {
  353. uni.openSetting()
  354. }
  355. }
  356. })
  357. }
  358. })
  359. } else {
  360. uni.downloadFile({
  361. url: imgUrl,
  362. success: function(res) {
  363. uni.saveImageToPhotosAlbum({
  364. filePath: res.tempFilePath,
  365. success: function(res) {
  366. wx.showToast({
  367. title: '保存成功',
  368. })
  369. }
  370. })
  371. }
  372. })
  373. }
  374. },
  375. fail(res) {}
  376. })
  377. },
  378. //拨打电话
  379. phone(tel) {
  380. uni.makePhoneCall({
  381. phoneNumber: tel
  382. })
  383. },
  384. setting(){
  385. this.$tab.navigateTo('/pages/globalPages/setting')
  386. },
  387. changePwd() {
  388. this.pwdShow = true
  389. },
  390. pwdSubmit() {
  391. if (this.newpassword) {
  392. updateUserInfo({
  393. password: this.newpassword
  394. }).then(res => {
  395. this.$modal.showToast('修改成功~')
  396. })
  397. this.pwdClose()
  398. } else {
  399. this.$modal.msg('请输入新密码!')
  400. }
  401. },
  402. pwdClose() {
  403. this.pwdShow = false
  404. }
  405. }
  406. }
  407. </script>
  408. <style lang="scss" scoped>
  409. .container {
  410. padding-bottom: 100rpx;
  411. // 个人信息
  412. .user {
  413. background: #2C6FF3 url('https://cdn.ossfile.mxrvending.com/assets/xy_merc_mini/images/globalPages/user-bg.png') no-repeat left top;
  414. background-size: 100%;
  415. padding-bottom: 145rpx;
  416. position: relative;
  417. width: 100%;
  418. .user-content {
  419. margin-top: 34rpx;
  420. width: 100%;
  421. .head-img {
  422. width: 100rpx;
  423. height: 100rpx;
  424. border-radius: 100rpx;
  425. margin-left: 26rpx;
  426. }
  427. .user-name {
  428. font-size: 28rpx;
  429. color: #fff;
  430. margin-left: 33rpx;
  431. }
  432. .share {
  433. width: 30rpx;
  434. height: 30rpx;
  435. position: relative;
  436. margin-left: 20rpx;
  437. .share-image {
  438. width: 30rpx;
  439. height: 30rpx;
  440. position: absolute;
  441. left: 0;
  442. top: 0;
  443. >image {
  444. width: 30rpx;
  445. height: 30rpx;
  446. }
  447. }
  448. button {
  449. width: 40rpx;
  450. height: 40rpx;
  451. position: absolute;
  452. left: 0;
  453. top: 0;
  454. opacity: 0;
  455. }
  456. }
  457. .login-out {
  458. width: 140rpx;
  459. line-height: 52rpx;
  460. height: 52rpx;
  461. text-align: center;
  462. font-size: 24rpx;
  463. color: #2C6FF3;
  464. background-color: #fff;
  465. position: absolute;
  466. right: 0;
  467. top: 185rpx;
  468. z-index: 99;
  469. border-top-left-radius: 52rpx;
  470. border-bottom-left-radius: 52rpx;
  471. }
  472. }
  473. }
  474. // 常用菜单
  475. .menu {
  476. width: 724rpx;
  477. margin-left: 14rpx;
  478. background: #FFFFFF;
  479. box-shadow: 0px 0px 10rpx 0px rgba(174, 201, 255, 0.2);
  480. border-radius: 14rpx;
  481. margin-top: 24rpx;
  482. position: relative;
  483. padding: 20rpx 36rpx 42rpx;
  484. &.menu-userinfo {
  485. padding: 36rpx;
  486. margin-top: -102rpx;
  487. }
  488. .menu-title {
  489. font-size: 30rpx;
  490. font-weight: 800;
  491. color: #000000;
  492. position: absolute;
  493. left: 28rpx;
  494. top: 28rpx;
  495. }
  496. .u-content {
  497. display: flex;
  498. flex-flow: row nowrap;
  499. justify-content: space-around;
  500. text-align: center;
  501. .u-item {
  502. line-height: 50rpx;
  503. .u-name {
  504. font-weight: bold;
  505. font-size: 30rpx;
  506. }
  507. .u-val {
  508. font-size: 28rpx;
  509. color: #666;
  510. position: relative;
  511. padding-left: 30rpx;
  512. display: inline-block;
  513. >image {
  514. width: 21rpx;
  515. height: 21rpx;
  516. position: absolute;
  517. left: 0;
  518. top: 50%;
  519. transform: translateY(-50%);
  520. }
  521. }
  522. }
  523. }
  524. .cu-btn {
  525. padding: 0 12rpx;
  526. font-size: 22rpx;
  527. height: 40rpx;
  528. line-height: 40rpx;
  529. background-color: #2C6FF3;
  530. color: #fff;
  531. }
  532. .edit {
  533. position: absolute;
  534. right: 28rpx;
  535. top: 28rpx;
  536. }
  537. .s-content {
  538. .s-item {
  539. line-height: 50rpx;
  540. >text {
  541. color: red;
  542. }
  543. }
  544. }
  545. .menu-item {
  546. display: flex;
  547. flex-direction: column;
  548. align-items: center;
  549. width: 25%;
  550. >.image {
  551. width: 74rpx;
  552. height: 74rpx;
  553. }
  554. >view {
  555. color: #333333;
  556. font-size: 26rpx;
  557. line-height: 26rpx;
  558. margin-top: 16rpx;
  559. }
  560. }
  561. }
  562. .qrcode-content {
  563. padding: 24rpx;
  564. .qrcode-img {
  565. width: 400rpx;
  566. height: 400rpx;
  567. }
  568. .save-qrcode {
  569. margin-top: 24rpx;
  570. }
  571. }
  572. .chang-password {
  573. text-align: center;
  574. line-height: 60rpx;
  575. color: #2C6FF3;
  576. text-decoration: underline;
  577. }
  578. .pwd-popup-content {
  579. padding: 24rpx;
  580. >view:nth-child(1) {
  581. width: 160rpx;
  582. }
  583. >view:nth-child(2) {
  584. width: 100%;
  585. }
  586. }
  587. }
  588. </style>