set.vue 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. <template>
  2. <view class="body">
  3. <!-- 公共组件-每个页面必须引入 -->
  4. <public-module></public-module>
  5. <block v-for="(item,index) in list" :key="index">
  6. <my-list-item :item="item" :index="index" @authModal="authModal" @weixinMsg="weixinMsg"
  7. @zhifubaoMsg="zhifubaoMsg" :someData="status"></my-list-item>
  8. </block>
  9. <button class="my-3 mt-4 mx-3 dis a-c j-c btn" type="primary" @tap="logout">退出登录</button>
  10. <auth-Modal :authShow="authShow" @btnClick="authShow=false" @maskClick="authShow=false"></auth-Modal>
  11. </view>
  12. </template>
  13. <script>
  14. import {
  15. mapState
  16. } from "vuex"
  17. import {
  18. mapMutations
  19. } from "vuex"
  20. import authModal from '@/components/modules/user/authModal.vue'; //实名认证弹窗
  21. import myListItem from "@/components/modules/my/my-list-item.vue";
  22. export default {
  23. components: {
  24. myListItem,
  25. authModal
  26. },
  27. data() {
  28. return {
  29. authShow: false,
  30. list: [{
  31. icon: "",
  32. name: "账号管理",
  33. clicktype: "navigateTo",
  34. url: "/pages/set/safe",
  35. auth: true
  36. },
  37. {
  38. icon: "",
  39. name: "实名认证",
  40. clicktype: "auth",
  41. text: "",
  42. borderColor: "",
  43. backColor: "",
  44. url: ""
  45. },
  46. {
  47. icon: "",
  48. name: "微信绑定",
  49. clicktype: "weixin",
  50. url: "",
  51. text: '未绑定',
  52. },
  53. {
  54. icon: "",
  55. name: "支付宝绑定",
  56. clicktype: "zhifubao",
  57. url: "",
  58. text: '未绑定',
  59. },
  60. {
  61. icon: "",
  62. name: "清除缓存",
  63. clicktype: "clear",
  64. url: "",
  65. },
  66. {
  67. icon: "",
  68. name: "常见问题",
  69. clicktype: "navigateTo",
  70. url: "/pages/set/question",
  71. auth: true
  72. },
  73. {
  74. icon: "",
  75. name: "关于掌柜",
  76. clicktype: "navigateTo",
  77. url: "/pages/set/about",
  78. text: "",
  79. auth: false
  80. },
  81. ],
  82. status: {
  83. weixinstatus: false,
  84. zhifubaostatus: false,
  85. }
  86. }
  87. },
  88. computed: {
  89. ...mapState(['userInfo'])
  90. },
  91. onLoad() {
  92. // #ifdef APP
  93. this.bindingStatus();
  94. this.isBindAlipay();
  95. //#endif
  96. if (this.userInfo.sysUser.status == '0' && this.userInfo.sysUser.managementSource == '2') {
  97. if (this.userInfo.sysUser.factorVerify == '2') {
  98. this.list[1].text = '实名认证失败';
  99. this.list[1].borderColor = '#FF0000';
  100. this.list[1].backColor = '#FFE2E2';
  101. this.lsit[1].url = '/pages/user/authInfo';
  102. } else {
  103. this.list[1].text = '未认证';
  104. this.list[1].borderColor = '#0052FF';
  105. this.list[1].backColor = '#DDE8FF';
  106. }
  107. } else if (this.userInfo.sysUser.status == '8') {
  108. this.list[1].text = '待补充资料';
  109. this.list[1].borderColor = '#FFB800';
  110. this.list[1].backColor = '#FFF3D3';
  111. this.lsit[1].url = '/pages/user/practitionerInfo';
  112. } else if (this.userInfo.sysUser.status == '3') {
  113. this.list[1].text = '审核不通过';
  114. this.list[1].borderColor = '#FF0000';
  115. this.list[1].backColor = '#FFE2E2';
  116. this.lsit[1].url = '/pages/user/practitionerInfo';
  117. } else if (this.userInfo.sysUser.status == '2') {
  118. this.list[1].text = '资料审核中';
  119. this.list[1].borderColor = '#FFB800';
  120. this.list[1].backColor = '#FFF3D3';
  121. this.lsit[1].url = '/pages/user/authResult1';
  122. } else if (this.userInfo.sysUser.status == '1') {
  123. this.list[1].text = '已认证';
  124. this.list[1].borderColor = '#0052FF';
  125. this.list[1].backColor = '#DDE8FF';
  126. }
  127. },
  128. async onShow() {
  129. // #ifdef APP
  130. let args = plus.runtime.arguments;
  131. if (args) {
  132. plus.runtime.arguments = null; //进入之后就把urlscheme清空要不然下一次oushow时还会执行
  133. // 处理args参数,如直达到某新页面等
  134. //通过code请求获取user_id
  135. var authCode = args.split("=")[1];
  136. if (authCode != undefined && authCode != "" && authCode != null) {
  137. let res = await this.$http.post("/alipay/bind", {
  138. code: authCode,
  139. })
  140. if (res.code == '200') {
  141. uni.showToast({
  142. title: res.msg,
  143. icon: "success"
  144. });
  145. this.isBindAlipay();
  146. } else {
  147. uni.showToast({
  148. title: res.msg,
  149. icon: "none"
  150. });
  151. }
  152. }
  153. }
  154. //#endif
  155. },
  156. methods: {
  157. ...mapMutations(['emptyUserInfo']),
  158. logout() {
  159. this.emptyUserInfo();
  160. setTimeout(() => {
  161. uni.reLaunch({
  162. url: "/pages/login/login"
  163. })
  164. return true;
  165. }, 500);
  166. },
  167. authModal(res) {
  168. this.authShow = res;
  169. },
  170. //微信绑定查询
  171. async bindingStatus() {
  172. let res = await this.$http.get("/user/isBindWechat")
  173. if (res.code == '200') {
  174. this.list[2].text = "已绑定"
  175. this.status.weixinstatus = true;
  176. } else {
  177. this.status.weixinstatus = false;
  178. }
  179. },
  180. //支付宝绑定查询
  181. async isBindAlipay() {
  182. let res = await this.$http.get("/alipay/isBindAlipay")
  183. if (res.code == '200') {
  184. this.list[3].text = "已绑定"
  185. this.status.zhifubaostatus = true;
  186. } else {
  187. this.status.zhifubaostatus = false;
  188. }
  189. },
  190. weixinMsg(res) {
  191. if (res.code == '200') {
  192. uni.showToast({
  193. title: res.msg,
  194. icon: "success"
  195. });
  196. this.bindingStatus();
  197. } else {
  198. uni.showToast({
  199. title: res.msg,
  200. icon: "none"
  201. });
  202. }
  203. },
  204. zhifubaoMsg(res) {
  205. console.log(res);
  206. if (res.code == '200') {
  207. uni.showToast({
  208. title: res.msg,
  209. icon: "success"
  210. });
  211. this.isBindAlipay();
  212. } else {
  213. uni.showToast({
  214. title: res.msg,
  215. icon: "none"
  216. });
  217. }
  218. }
  219. }
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .btn {
  224. background: #fff;
  225. border-radius: 4px;
  226. border: 1px solid #343EEF;
  227. color: #343EEF;
  228. font-size: 32rpx;
  229. }
  230. </style>