personal.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view>
  3. <u-notify ref="uNotify" message="Hi uView"></u-notify>
  4. <!--头部-->
  5. <view class="my_top">
  6. <image src="../../static/images/top-bg.png" class="bg"></image>
  7. </view>
  8. <view class="list animated fadeInDown">
  9. <!--只有外籍商户和收购商才需要手动认证-->
  10. <view class="message _error" @click="go('/pages/authentication/index')" v-if="user.userType == 5 && user.auth == 0">
  11. <text class="icon">&#xe64e;</text>
  12. <text>你还未认证,请先认证</text>
  13. <text class="icon" style="float: right">&#xe8f2;</text>
  14. </view>
  15. <view class="message _error" @click="go('/pages/authentication/purchaser/index')" v-if="user.userType == 3 && user.auth == 0">
  16. <text class="icon">&#xe64e;</text>
  17. <text>你还未认证,请先认证</text>
  18. <text class="icon" style="float: right">&#xe8f2;</text>
  19. </view>
  20. <view class="message _info" @click="go('/pages/authentication/face')" v-if="(user.userType == 1 || user.userType == 2) && user.face == 0">
  21. <text class="icon">&#xe78d;</text>
  22. <text>你还未人脸认证,请先人脸认证</text>
  23. <text class="icon" style="float: right">&#xe8f2;</text>
  24. </view>
  25. <!--用户信息-->
  26. <view class="user">
  27. <image src="../../static/icon/user.png" mode="widthFix" class="head"></image>
  28. <view class="con">
  29. <view class="nickName omit">{{ user.phone }}</view>
  30. <view class="tag" v-if="user.userType == 1">普通边民</view>
  31. <view class="tag" v-if="user.userType == 2">互市组长</view>
  32. <view class="tag" v-if="user.userType == 3">收购商</view>
  33. <view class="tag" v-if="user.userType == 4">司机</view>
  34. <view class="tag" v-if="user.userType == 5">外籍商户</view>
  35. <view class="tag" v-if="user.userType == 6">合作社</view>
  36. </view>
  37. <text class="icon edit" @click="go('/pages/personal/my')">&#xe645;</text>
  38. <view class="clear"></view>
  39. </view>
  40. <!--边民菜单-->
  41. <!-- <view class="menu" v-if="user.userType == 1">
  42. <view class="msn" @click="go('/pages/market/one/leader/order')">
  43. <view class="out">
  44. <view class="int">
  45. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  46. <view class="tit">我的订单</view>
  47. </view>
  48. </view>
  49. </view>
  50. </view> -->
  51. <!--边民菜单与组长菜单-->
  52. <view class="menu" v-if="user.userType == 1 || user.userType == 2">
  53. <!-- <view class="msn" @click="go('/pages/market/one/leader/cart')">
  54. <view class="out">
  55. <view class="int">
  56. <view class="icon ioc" style="background-color: #fff6e0; color: #f1ba41">&#xe604;</view>
  57. <view class="tit">购物车</view>
  58. </view>
  59. </view>
  60. </view> -->
  61. <view class="msn" @click="go('/pages/market/one/leader/order')">
  62. <view class="out">
  63. <view class="int">
  64. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  65. <view class="tit">一级订单</view>
  66. </view>
  67. </view>
  68. </view>
  69. <view class="msn" @click="go('/pages/market/two/leader/order')">
  70. <view class="out">
  71. <view class="int">
  72. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  73. <view class="tit">二级订单</view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <!--收购商-->
  79. <view class="menu" v-if="user.userType == 3">
  80. <view class="msn" @click="go('/pages/market/two/purchaser/order/cart')">
  81. <view class="out">
  82. <view class="int">
  83. <view class="icon ioc" style="background-color: #fff6e0; color: #f1ba41">&#xe604;</view>
  84. <view class="tit">购物车</view>
  85. </view>
  86. </view>
  87. </view>
  88. <!-- <view class="msn" @click="go('/pages/market/two/purchaser/buy/list')">
  89. <view class="out">
  90. <view class="int">
  91. <view class="icon ioc" style="background-color: #e1f6e9; color: #47cf74">&#xe634;</view>
  92. <view class="tit">采购需求</view>
  93. </view>
  94. </view>
  95. </view> -->
  96. <view class="msn" @click="go('/pages/market/two/purchaser/address/list')">
  97. <view class="out">
  98. <view class="int">
  99. <view class="icon ioc" style="background-color: #fff6e0; color: #f1ba41">&#xe623;</view>
  100. <view class="tit">地址管理</view>
  101. </view>
  102. </view>
  103. </view>
  104. <view class="msn" @click="go('/pages/market/two/purchaser/order/list')">
  105. <view class="out">
  106. <view class="int">
  107. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  108. <view class="tit">我的订单</view>
  109. </view>
  110. </view>
  111. </view>
  112. <view class="msn" @click="go('/pages/authentication/purchaser/info')">
  113. <view class="out">
  114. <view class="int">
  115. <view class="icon ioc" style="background-color: #e0ffff; color: #00bfff">&#xe660;</view>
  116. <view class="tit">我的认证</view>
  117. </view>
  118. </view>
  119. </view>
  120. </view>
  121. <!--外籍商户-->
  122. <view class="menu" v-if="user.userType == 5">
  123. <view class="msn" @click="go('/pages/market/one/merchant/goods/list')">
  124. <view class="out">
  125. <view class="int">
  126. <view class="icon ioc" style="background-color: #e1f6e9; color: #47cf74">&#xe634;</view>
  127. <view class="tit">商品管理</view>
  128. </view>
  129. </view>
  130. </view>
  131. <view class="msn" @click="go('/pages/market/one/merchant/order/list')">
  132. <view class="out">
  133. <view class="int">
  134. <view class="icon ioc" style="background-color: #f0dcfc; color: #b064d8">&#xe628;</view>
  135. <view class="tit">我的订单</view>
  136. </view>
  137. </view>
  138. </view>
  139. <view class="msn" @click="go('/pages/authentication/index')">
  140. <view class="out">
  141. <view class="int">
  142. <view class="icon ioc" style="background-color: #e0ffff; color: #00bfff">&#xe660;</view>
  143. <view class="tit">我的认证</view>
  144. </view>
  145. </view>
  146. </view>
  147. </view>
  148. <!--合作社-->
  149. <view class="menu" v-if="user.userType == 6">
  150. <view class="msn" @click="go('/pages/market/one/cooperative/order')">
  151. <view class="out">
  152. <view class="int">
  153. <view class="icon ioc" style="background-color: #e1f6e9; color: #47cf74">&#xe634;</view>
  154. <view class="tit">大订单</view>
  155. </view>
  156. </view>
  157. </view>
  158. </view>
  159. <view class="cmd">
  160. <view class="s_item" @click="go('/pages/login/userAgreement?id=1')">
  161. <text class="icon ic">&#xe662;</text>
  162. <text class="title">用户协议</text>
  163. <text class="icon arrow">&#xe8f2;</text>
  164. </view>
  165. <view class="s_item" @click="go('/pages/login/userAgreement?id=2')">
  166. <text class="icon ic">&#xe643;</text>
  167. <text class="title">隐私协议</text>
  168. <text class="icon arrow">&#xe8f2;</text>
  169. </view>
  170. <view class="s_item" @click="go('/pages/personal/setting')">
  171. <text class="icon ic">&#xe817;</text>
  172. <text class="title">设置</text>
  173. <text class="icon arrow">&#xe8f2;</text>
  174. </view>
  175. </view>
  176. <button class="btn exit" @click="exitLogin()">退出登录</button>
  177. </view>
  178. </view>
  179. </template>
  180. <script>
  181. export default {
  182. data() {
  183. return {
  184. user: {}
  185. };
  186. },
  187. onLoad() {
  188. //人脸认证界面成功的回调
  189. uni.$on('face', res => {
  190. this.http.request({
  191. url: '/sp-admin/app/AppUser/face',
  192. method: 'POST',
  193. success: res => {
  194. this.user.face = 1;
  195. }
  196. });
  197. });
  198. },
  199. onShow() {
  200. this.user = this.getUser();
  201. if (!this.hasAuth()) {
  202. this.http.request({
  203. url: '/sp-admin/app/AppUser/getAuth',
  204. success: res => {
  205. this.user.auth = res.data.data.auth;
  206. this.user.face=res.data.data.face;
  207. }
  208. });
  209. }
  210. },
  211. methods: {
  212. order() {
  213. if (!this.hasAuth()) {
  214. uni.navigateTo({ url: '/pages/authentication/index' });
  215. return;
  216. }
  217. //组长
  218. if (this.user.userType == 2) {
  219. uni.navigateTo({ url: 'user' });
  220. }
  221. //外籍商户
  222. if (this.user.userType == 5) {
  223. uni.navigateTo({ url: '/pages/market/one/merchant/order/list' });
  224. }
  225. //收购商
  226. if (this.user.userType == 3) {
  227. uni.navigateTo({ url: '/pages/market/two/purchaser/order/list' });
  228. }
  229. },
  230. go(url) {
  231. if (!this.hasAuth() && this.user.userType == 5) {
  232. uni.navigateTo({ url: '/pages/authentication/index' });
  233. return;
  234. }
  235. if (!this.hasAuth() && this.user.userType == 3) {
  236. uni.navigateTo({ url: '/pages/authentication/purchaser/index' });
  237. return;
  238. }
  239. uni.navigateTo({ url: url });
  240. },
  241. exitLogin() {
  242. let param = {
  243. appUserId: this.getUser().id
  244. };
  245. uni.showModal({
  246. title: '提示',
  247. content: '确定注销登录?',
  248. success: res => {
  249. if (res.confirm) {
  250. uni.removeStorageSync('token');
  251. uni.removeStorageSync('info');
  252. uni.removeStorageSync('menu');
  253. uni.redirectTo({ url: '/pages/login/login' });
  254. this.http.request({
  255. url: '/sp-admin/app/AppUser/logout',
  256. data: param,
  257. success: res => {
  258. }
  259. });
  260. }
  261. }
  262. });
  263. }
  264. }
  265. };
  266. </script>
  267. <style lang="scss">
  268. page {
  269. background-color: #f5f5f5;
  270. }
  271. .my_top {
  272. position: relative;
  273. overflow: hidden;
  274. image {
  275. width: 100%;
  276. }
  277. }
  278. .list {
  279. position: relative;
  280. padding: 0px 20px 10px 20px;
  281. margin-top: -196px;
  282. .user {
  283. background-color: white;
  284. padding: 20px;
  285. border-radius: 8px;
  286. color: $font-c;
  287. .head {
  288. float: left;
  289. width: 55px;
  290. height: 55px;
  291. }
  292. .con {
  293. float: left;
  294. padding-left: 15px;
  295. width: 60%;
  296. .nickName {
  297. font-size: 17px;
  298. font-weight: bold;
  299. }
  300. .tag {
  301. background-color: #6799ad;
  302. color: white;
  303. float: left;
  304. font-size: 13px;
  305. padding: 2px 6px;
  306. border-radius: 5px;
  307. margin-top: 6px;
  308. }
  309. }
  310. .edit {
  311. float: right;
  312. font-size: 20px;
  313. margin-top: 17px;
  314. }
  315. }
  316. }
  317. .exit {
  318. margin-top: 20px;
  319. background-color: white;
  320. color: #f44336;
  321. }
  322. </style>