index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  1. <template>
  2. <view class="me-content" :style="{'--status-bar-': statusBarHeight}">
  3. <view class="me-content-info">
  4. <!-- 头部主要内容 开始 -->
  5. <view class="me-content-header">
  6. <customNavbar
  7. title="我的"
  8. bgColor="#fff"
  9. :is-left="false"
  10. :contentStyle="{color: '#000'}"
  11. ></customNavbar>
  12. </view>
  13. <!-- 头部主要内容 结束 -->
  14. <!-- userInfo内容 开始 -->
  15. <view class="me-content-userinfo">
  16. <view class="me-userinfo-info">
  17. <view><text>分销商名称:</text><text>{{ userInfo && userInfo.name }}</text></view>
  18. <view><text>负责人:</text><text>{{ userInfo && userInfo.contact }}</text></view>
  19. <view class="me-userinfo-info-set" @click="navigateToFun({url: '/pages/resetpass/index'})">
  20. <u-icon size="22" name="setting" color="#ffffff" ></u-icon>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- userInfo内容 结束 -->
  25. <!-- tool内容 开始 -->
  26. <view class="me-content-tool">
  27. <view
  28. class="me-tool-item"
  29. v-for="(item,index) in tool"
  30. :key="index"
  31. @click="navigateToFun(item)"
  32. v-if="(withdrawInfo.allowWithdraw == 1 && item.title=='余额提现')||item.title!='余额提现'"
  33. >
  34. <image
  35. class="me-tool-item-icon"
  36. :src="item.icon"></image>
  37. <text>{{ item.title }}</text>
  38. <view><u-icon name="arrow-right"></u-icon></view>
  39. </view>
  40. </view>
  41. <!-- tool内容 结束 -->
  42. <!-- 退出登录 -->
  43. <view class="me-content-loginout">
  44. <u-button
  45. class="login-info-submit-but"
  46. @click="submit()"
  47. :loading="loading"
  48. loadingText="退出中..."
  49. >退出登录</u-button>
  50. </view>
  51. </view>
  52. <!-- 我的分享码 -->
  53. <customPromotionCode ref="customPromotionCode" />
  54. <!-- 入网认证 -->
  55. <u-modal
  56. :show="show"
  57. :title="title1"
  58. :content='content'
  59. cancelText='取消'
  60. :confirmText='confirmText'
  61. showCancelButton
  62. confirmColor='#ED0000'
  63. @confirm='networkConfirm'
  64. @cancel='networkCancel'
  65. @close='networkCancel'
  66. ></u-modal>
  67. </view>
  68. </template>
  69. <script>
  70. import { navigateTo } from "@/utils/util.js"
  71. export default {
  72. data() {
  73. return {
  74. title: '这是我的',
  75. loading: false,
  76. statusBarHeight: 0, // 状态栏安全距离
  77. tool: [ // 我的工具
  78. { title: "邀请统计",icon: this.$commonConfig.staticUrl + 'me/yijian2.png', url: '/pages/invitationStatistics/index' },
  79. { title: "余额提现",icon: this.$commonConfig.staticUrl + 'me/beifeng.png', url: '/pages/balance/index' },
  80. { title: "我的推广码",icon: this.$commonConfig.staticUrl + 'me/yijian1.png', url: '' },
  81. { title: "我的银行卡",icon: this.$commonConfig.staticUrl + 'me/yijian1.png', url: '/pages/bankCard/index' },
  82. // { title: "提现记录",icon: this.$commonConfig.staticUrl + 'me/beifeng.png', url: '/pages/cashList/index' },
  83. ],
  84. userInfo: {},
  85. withdrawInfo: {},
  86. // 入网认证
  87. isShowQrcode: -1, // 是否展示 推广码
  88. show: false,
  89. title1:'提示',
  90. content:'你的二维码已关闭!',
  91. confirmText: '确认',
  92. }
  93. },
  94. mounted() {
  95. // console.log('wpsdfsfasdfads')
  96. this.statusBarHeight = getApp().globalData.statusBarHeight
  97. this.show = false
  98. this.getUserInfo()
  99. // #ifdef H5
  100. //window.addEventListener('popstate', this.browserBack)
  101. // #endif
  102. },
  103. destroyed() {
  104. // console.log("dsfadsfsdfasdf")
  105. //window.removeEventListener("popstate", this.browserBack);
  106. },
  107. methods: {
  108. /**
  109. * @author ygh
  110. * @data 2023-12-20
  111. */
  112. async navigateToFun(item){
  113. if(item.url) {
  114. navigateTo(item.url)
  115. }else {
  116. let res = await this.$u.api.getInfo({
  117. noSign: 1,
  118. userid: this.distribution_user_info.userId
  119. })
  120. this.isShowQrcode = res.data.qrcodeStatus
  121. if(this.isShowQrcode === 0) {
  122. this.show = true
  123. } else {
  124. this.getRetailQrcode()
  125. }
  126. }
  127. },
  128. /**
  129. * 获取用户信息
  130. */
  131. async getUserInfo() {
  132. try{
  133. let res = await this.$u.api.getInfo({
  134. noSign: 1,
  135. userid: this.distribution_user_info.userId
  136. })
  137. let res1 = await this.$u.api.withdrawInfo({
  138. noSign: 1,
  139. userid: this.distribution_user_info.userId
  140. })
  141. if(res && res.code ===200) {
  142. this.userInfo = res.data
  143. this.isShowQrcode = res.data.qrcodeStatus
  144. }
  145. if(res1 && res1.code === 200){
  146. this.withdrawInfo = res.data
  147. }
  148. }catch(e){
  149. this.isShowQrcode = -1
  150. //TODO handle the exception
  151. console.error("e===",e)
  152. }
  153. },
  154. /**
  155. * 我的推广码
  156. */
  157. async getRetailQrcode(){
  158. try{
  159. let res = await this.$u.api.getRetailQrcode({
  160. noSign: 1,
  161. userid: this.distribution_user_info.userId
  162. })
  163. if(res && res.code ===200) {
  164. this.$refs.customPromotionCode.initData(res.data)
  165. // #ifdef H5
  166. //window.history.pushState(null, null, document.URL)
  167. // #endif
  168. }
  169. }catch(e){
  170. //TODO handle the exception
  171. console.error("e===",e)
  172. }
  173. },
  174. /**
  175. *
  176. * 提交登录
  177. *
  178. */
  179. submit() {
  180. // 在这里写弹框
  181. uni.showModal({
  182. title: '提示',
  183. content: '确定退出登录吗?',
  184. cancelText: '取消',
  185. confirmText: '确定',
  186. success: (res) => {
  187. if(res.confirm){
  188. this.loginOut()
  189. }
  190. }
  191. });
  192. },
  193. async loginOut() {
  194. // console.log("distribution_user_info===",this.distribution_user_info)
  195. // return
  196. // if(!this.distribution_user_info.accessToken) {
  197. // this.$u.vuex('distribution_user_info', {});
  198. // uni.reLaunch({
  199. // url: "/pages/login/index"
  200. // })
  201. // return
  202. // }
  203. this.loading = true
  204. try{
  205. let res = await this.$u.api.loginOut({})
  206. this.loading = false
  207. if(res && res.code ===200) {
  208. uni.setStorageSync('lifeDataDistribution',{}); // 清除缓存
  209. this.$u.vuex('distribution_user_info', {});
  210. uni.reLaunch({
  211. url: "/pages/login/index"
  212. })
  213. } else {
  214. // uni.showToast({
  215. // icon: "none",
  216. // title: res.msg
  217. // })
  218. uni.setStorageSync('lifeDataDistribution',{}); // 清除缓存
  219. this.$u.vuex('distribution_user_info', {});
  220. uni.reLaunch({
  221. url: "/pages/login/index"
  222. })
  223. }
  224. this.loading = false
  225. }catch(e){
  226. //TODO handle the exception
  227. console.error("e===",e)
  228. // uni.showToast({
  229. // icon: "none",
  230. // title: "退出失败"
  231. // })
  232. uni.setStorageSync('lifeDataDistribution',{}); // 清除缓存
  233. this.$u.vuex('distribution_user_info', {});
  234. uni.reLaunch({
  235. url: "/pages/login/index"
  236. })
  237. this.loading = false
  238. }
  239. },
  240. browserBack() {
  241. // 在这里写弹框
  242. uni.showModal({
  243. title: '提示',
  244. content: '返回后此页面的操作将不作保留!',
  245. cancelText: '确定返回',
  246. confirmText: '留在此页',
  247. success: (res) => {
  248. if (res.confirm) {
  249. // 用户选择留在此页,不进行任何操作
  250. } else if (res.cancel) {
  251. //window.history.back(); // 使用window.history.back()返回上一页
  252. }
  253. }
  254. });
  255. //window.history.replaceState(null, null, document.URL); // 保留此行代码
  256. },
  257. /** 入网认证 */
  258. networkConfirm() {
  259. this.show = false
  260. // navigateTo('/pages/networkAuth/index') // 去除跳转(20250418)
  261. //this.getUnionAccessUrlFun()
  262. },
  263. networkCancel() {
  264. this.show = false
  265. },
  266. /** 银联签约入网地址 */
  267. async getUnionAccessUrlFun(){
  268. try{
  269. let res = await this.$u.api.getUnionAccessUrl({
  270. userid: this.distribution_user_info.userId
  271. })
  272. if(res && res.code ===200) {
  273. this.show = false
  274. location.href = res.data.jumpUrl
  275. } else {
  276. this.show = true
  277. }
  278. }catch(e){
  279. //TODO handle the exception
  280. this.show = true
  281. console.error("e===",e)
  282. }
  283. }
  284. }
  285. }
  286. </script>
  287. <style lang="scss" scoped>
  288. .me-content {
  289. display: flex;
  290. flex-direction: column;
  291. align-items: center;
  292. justify-content: center;
  293. --header-h: 90rpx;
  294. .me-content-info {
  295. width: 100%;
  296. box-sizing: border-box;
  297. }
  298. }
  299. /** 头部主要内容 开始 */
  300. .me-content-header {
  301. width: 100%;
  302. height: var(--header-h);
  303. box-sizing: border-box;
  304. ::v-deep .u-search {
  305. padding: 0 30rpx !important;
  306. }
  307. ::v-deep .u-search__action {
  308. color: #fff !important;
  309. }
  310. }
  311. /** 头部主要内容 结束 **/
  312. /** userInfo内容 开始 */
  313. .me-content-userinfo {
  314. width: 100%;
  315. padding: 24rpx;
  316. box-sizing: border-box;
  317. .me-userinfo-info {
  318. width: 100%;
  319. height: 200rpx;
  320. box-sizing: border-box;
  321. background: linear-gradient(to bottom, rgba(238, 12, 12, 1) 0%, rgba(243, 157, 159, 1) 100%);
  322. border-radius: 20rpx;
  323. box-shadow: 0rpx 0 20rpx 2rpx rgba(205, 205, 205, 0.50);
  324. display: flex;
  325. flex-direction: column;
  326. align-items: flex-start;
  327. justify-content: center;
  328. color: #fff;
  329. font-size: 28rpx;
  330. font-family: SourceHanSansCN, SourceHanSansCN;
  331. padding: 0 50rpx;
  332. position: relative;
  333. >view:nth-child(1) {
  334. display: flex;
  335. font-weight: 600;
  336. width: 100%;
  337. text:nth-child(1) {
  338. width: 168rpx;
  339. flex-shrink: 0;
  340. }
  341. text:nth-child(2) {
  342. width: calc( 100% - 168rpx );
  343. overflow: hidden;
  344. display: -webkit-box;
  345. -webkit-line-clamp: 2; /* 设置最大显示行数 */
  346. -webkit-box-orient: vertical;
  347. text-overflow: ellipsis;
  348. }
  349. }
  350. >view:nth-child(2) {
  351. width: 100%;
  352. display: flex;
  353. margin-top: 20rpx;
  354. text:nth-child(1) {
  355. width: 112rpx;
  356. flex-shrink: 0;
  357. }
  358. text:nth-child(2) {
  359. width: calc( 100% - 112rpx );
  360. }
  361. }
  362. .me-userinfo-info-set {
  363. position: absolute;
  364. top: 10px;
  365. right: 10px;
  366. z-index: 99;
  367. }
  368. }
  369. }
  370. /** userInfo内容 结束 **/
  371. /** tool内容 开始 */
  372. .me-content-tool {
  373. width: 100%;
  374. box-sizing: border-box;
  375. padding: 30rpx 30rpx 0;
  376. .me-tool-item {
  377. width: 100%;
  378. background: #FBFBFB;
  379. border-radius: 20rpx;
  380. box-sizing: border-box;
  381. display: flex;
  382. align-items: center;
  383. justify-content: space-between;
  384. color: rgba(54, 54, 54, 1);
  385. font-size: 28rpx;
  386. padding: 12rpx 10rpx;
  387. margin-bottom: 20rpx;
  388. .me-tool-item-icon {
  389. width: 54rpx;
  390. height: 56rpx;
  391. flex-shrink: 0;
  392. }
  393. >text {
  394. width: 100%;
  395. padding-left: 20rpx;
  396. box-sizing: border-box;
  397. }
  398. }
  399. }
  400. /** tool内容 结束 */
  401. /** */
  402. .me-content-loginout {
  403. width: 100%;
  404. padding: 50rpx 50rpx 0;
  405. box-sizing: border-box;
  406. .login-info-submit-but {
  407. display: flex;
  408. justify-content: center;
  409. align-items: center;
  410. border-radius: 40rpx;
  411. width: 100% !important;
  412. height: 80rpx !important;
  413. background-color: var(--gd-bgm-color);
  414. color: #fff;
  415. }
  416. }
  417. </style>