index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443
  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/beifeng.png', url: '/pages/cashList/index' },
  82. ],
  83. userInfo: {},
  84. withdrawInfo: {},
  85. // 入网认证
  86. isShowQrcode: -1, // 是否展示 推广码
  87. show: false,
  88. title1:'入网提示',
  89. content:'你还未进行银联支付入网签约认证,请先完成签约认证!',
  90. confirmText: '去认证',
  91. }
  92. },
  93. mounted() {
  94. console.log('wpsdfsfasdfads')
  95. this.statusBarHeight = getApp().globalData.statusBarHeight
  96. this.show = false
  97. this.getUserInfo()
  98. // #ifdef H5
  99. //window.addEventListener('popstate', this.browserBack)
  100. // #endif
  101. },
  102. destroyed() {
  103. console.log("dsfadsfsdfasdf")
  104. //window.removeEventListener("popstate", this.browserBack);
  105. },
  106. methods: {
  107. /**
  108. * @author ygh
  109. * @data 2023-12-20
  110. */
  111. async navigateToFun(item){
  112. if(item.url) {
  113. navigateTo(item.url)
  114. }else {
  115. let res = await this.$u.api.getInfo({
  116. noSign: 1,
  117. userid: this.distribution_user_info.userId
  118. })
  119. this.isShowQrcode = res.data.unionFlag
  120. if(this.isShowQrcode != 1) {
  121. if(this.isShowQrcode == 0) {
  122. this.content = '你还未进行银联支付入网签约认证,请先完成签约认证!'
  123. this.confirmText = '去认证'
  124. }else if(this.isShowQrcode == 2) {
  125. this.content = '银联支付入网签约认证中,请耐心等待!'
  126. this.confirmText = '去查看'
  127. }else if(this.isShowQrcode == 3) {
  128. this.content = '银联支付入网签约认证失败,请重新认证!'
  129. this.confirmText = '重新认证'
  130. }
  131. this.show = true
  132. }else {
  133. this.getRetailQrcode()
  134. }
  135. }
  136. },
  137. /**
  138. * 获取用户信息
  139. */
  140. async getUserInfo() {
  141. try{
  142. let res = await this.$u.api.getInfo({
  143. noSign: 1,
  144. userid: this.distribution_user_info.userId
  145. })
  146. let res1 = await this.$u.api.withdrawInfo({
  147. noSign: 1,
  148. userid: this.distribution_user_info.userId
  149. })
  150. if(res && res.code ===200) {
  151. this.userInfo = res.data
  152. this.isShowQrcode = res.data.unionFlag
  153. }
  154. if(res1 && res1.code === 200){
  155. this.withdrawInfo = res.data
  156. }
  157. }catch(e){
  158. this.isShowQrcode = -1
  159. //TODO handle the exception
  160. console.error("e===",e)
  161. }
  162. },
  163. /**
  164. * 我的推广码
  165. */
  166. async getRetailQrcode(){
  167. try{
  168. let res = await this.$u.api.getRetailQrcode({
  169. noSign: 1,
  170. userid: this.distribution_user_info.userId
  171. })
  172. if(res && res.code ===200) {
  173. this.$refs.customPromotionCode.initData(res.data)
  174. // #ifdef H5
  175. //window.history.pushState(null, null, document.URL)
  176. // #endif
  177. }
  178. }catch(e){
  179. //TODO handle the exception
  180. console.error("e===",e)
  181. }
  182. },
  183. /**
  184. *
  185. * 提交登录
  186. *
  187. */
  188. submit() {
  189. // 在这里写弹框
  190. uni.showModal({
  191. title: '提示',
  192. content: '确定退出登录吗?',
  193. cancelText: '取消',
  194. confirmText: '确定',
  195. success: (res) => {
  196. if(res.confirm){
  197. this.loginOut()
  198. }
  199. }
  200. });
  201. },
  202. async loginOut() {
  203. // console.log("distribution_user_info===",this.distribution_user_info)
  204. // return
  205. // if(!this.distribution_user_info.accessToken) {
  206. // this.$u.vuex('distribution_user_info', {});
  207. // uni.reLaunch({
  208. // url: "/pages/login/index"
  209. // })
  210. // return
  211. // }
  212. this.loading = true
  213. try{
  214. let res = await this.$u.api.loginOut({})
  215. this.loading = false
  216. if(res && res.code ===200) {
  217. uni.setStorageSync('lifeDataDistribution',{}); // 清除缓存
  218. this.$u.vuex('distribution_user_info', {});
  219. uni.reLaunch({
  220. url: "/pages/login/index"
  221. })
  222. } else {
  223. // uni.showToast({
  224. // icon: "none",
  225. // title: res.msg
  226. // })
  227. uni.setStorageSync('lifeDataDistribution',{}); // 清除缓存
  228. this.$u.vuex('distribution_user_info', {});
  229. uni.reLaunch({
  230. url: "/pages/login/index"
  231. })
  232. }
  233. this.loading = false
  234. }catch(e){
  235. //TODO handle the exception
  236. console.error("e===",e)
  237. // uni.showToast({
  238. // icon: "none",
  239. // title: "退出失败"
  240. // })
  241. uni.setStorageSync('lifeDataDistribution',{}); // 清除缓存
  242. this.$u.vuex('distribution_user_info', {});
  243. uni.reLaunch({
  244. url: "/pages/login/index"
  245. })
  246. this.loading = false
  247. }
  248. },
  249. browserBack() {
  250. // 在这里写弹框
  251. uni.showModal({
  252. title: '提示',
  253. content: '返回后此页面的操作将不作保留!',
  254. cancelText: '确定返回',
  255. confirmText: '留在此页',
  256. success: (res) => {
  257. if (res.confirm) {
  258. // 用户选择留在此页,不进行任何操作
  259. } else if (res.cancel) {
  260. //window.history.back(); // 使用window.history.back()返回上一页
  261. }
  262. }
  263. });
  264. //window.history.replaceState(null, null, document.URL); // 保留此行代码
  265. },
  266. /** 入网认证 */
  267. networkConfirm() {
  268. this.show = false
  269. navigateTo('/pages/networkAuth/index')
  270. //this.getUnionAccessUrlFun()
  271. },
  272. networkCancel() {
  273. this.show = false
  274. },
  275. /** 银联签约入网地址 */
  276. async getUnionAccessUrlFun(){
  277. try{
  278. let res = await this.$u.api.getUnionAccessUrl({
  279. userid: this.distribution_user_info.userId
  280. })
  281. if(res && res.code ===200) {
  282. this.show = false
  283. location.href = res.data.jumpUrl
  284. } else {
  285. this.show = true
  286. }
  287. }catch(e){
  288. //TODO handle the exception
  289. this.show = true
  290. console.error("e===",e)
  291. }
  292. }
  293. }
  294. }
  295. </script>
  296. <style lang="scss" scoped>
  297. .me-content {
  298. display: flex;
  299. flex-direction: column;
  300. align-items: center;
  301. justify-content: center;
  302. --header-h: 90rpx;
  303. .me-content-info {
  304. width: 100%;
  305. box-sizing: border-box;
  306. }
  307. }
  308. /** 头部主要内容 开始 */
  309. .me-content-header {
  310. width: 100%;
  311. height: var(--header-h);
  312. box-sizing: border-box;
  313. ::v-deep .u-search {
  314. padding: 0 30rpx !important;
  315. }
  316. ::v-deep .u-search__action {
  317. color: #fff !important;
  318. }
  319. }
  320. /** 头部主要内容 结束 **/
  321. /** userInfo内容 开始 */
  322. .me-content-userinfo {
  323. width: 100%;
  324. padding: 24rpx;
  325. box-sizing: border-box;
  326. .me-userinfo-info {
  327. width: 100%;
  328. height: 200rpx;
  329. box-sizing: border-box;
  330. background: linear-gradient(to bottom, rgba(238, 12, 12, 1) 0%, rgba(243, 157, 159, 1) 100%);
  331. border-radius: 20rpx;
  332. box-shadow: 0rpx 0 20rpx 2rpx rgba(205, 205, 205, 0.50);
  333. display: flex;
  334. flex-direction: column;
  335. align-items: flex-start;
  336. justify-content: center;
  337. color: #fff;
  338. font-size: 28rpx;
  339. font-family: SourceHanSansCN, SourceHanSansCN;
  340. padding: 0 50rpx;
  341. position: relative;
  342. >view:nth-child(1) {
  343. display: flex;
  344. font-weight: 600;
  345. width: 100%;
  346. text:nth-child(1) {
  347. width: 168rpx;
  348. flex-shrink: 0;
  349. }
  350. text:nth-child(2) {
  351. width: calc( 100% - 168rpx );
  352. overflow: hidden;
  353. display: -webkit-box;
  354. -webkit-line-clamp: 2; /* 设置最大显示行数 */
  355. -webkit-box-orient: vertical;
  356. text-overflow: ellipsis;
  357. }
  358. }
  359. >view:nth-child(2) {
  360. width: 100%;
  361. display: flex;
  362. margin-top: 20rpx;
  363. text:nth-child(1) {
  364. width: 112rpx;
  365. flex-shrink: 0;
  366. }
  367. text:nth-child(2) {
  368. width: calc( 100% - 112rpx );
  369. }
  370. }
  371. .me-userinfo-info-set {
  372. position: absolute;
  373. top: 10px;
  374. right: 10px;
  375. z-index: 99;
  376. }
  377. }
  378. }
  379. /** userInfo内容 结束 **/
  380. /** tool内容 开始 */
  381. .me-content-tool {
  382. width: 100%;
  383. box-sizing: border-box;
  384. padding: 30rpx 30rpx 0;
  385. .me-tool-item {
  386. width: 100%;
  387. background: #FBFBFB;
  388. border-radius: 20rpx;
  389. box-sizing: border-box;
  390. display: flex;
  391. align-items: center;
  392. justify-content: space-between;
  393. color: rgba(54, 54, 54, 1);
  394. font-size: 28rpx;
  395. padding: 12rpx 10rpx;
  396. margin-bottom: 20rpx;
  397. .me-tool-item-icon {
  398. width: 54rpx;
  399. height: 56rpx;
  400. flex-shrink: 0;
  401. }
  402. >text {
  403. width: 100%;
  404. padding-left: 20rpx;
  405. box-sizing: border-box;
  406. }
  407. }
  408. }
  409. /** tool内容 结束 */
  410. /** */
  411. .me-content-loginout {
  412. width: 100%;
  413. padding: 50rpx 50rpx 0;
  414. box-sizing: border-box;
  415. .login-info-submit-but {
  416. display: flex;
  417. justify-content: center;
  418. align-items: center;
  419. border-radius: 40rpx;
  420. width: 100% !important;
  421. height: 80rpx !important;
  422. background-color: var(--gd-bgm-color);
  423. color: #fff;
  424. }
  425. }
  426. </style>