personal.vue 9.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326
  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. uni.setStorageSync('info', this.user);
  208. }
  209. });
  210. }
  211. },
  212. methods: {
  213. order() {
  214. if (!this.hasAuth()) {
  215. uni.navigateTo({ url: '/pages/authentication/index' });
  216. return;
  217. }
  218. //组长
  219. if (this.user.userType == 2) {
  220. uni.navigateTo({ url: 'user' });
  221. }
  222. //外籍商户
  223. if (this.user.userType == 5) {
  224. uni.navigateTo({ url: '/pages/market/one/merchant/order/list' });
  225. }
  226. //收购商
  227. if (this.user.userType == 3) {
  228. uni.navigateTo({ url: '/pages/market/two/purchaser/order/list' });
  229. }
  230. },
  231. go(url) {
  232. if (!this.hasAuth() && this.user.userType == 5) {
  233. uni.navigateTo({ url: '/pages/authentication/index' });
  234. return;
  235. }
  236. if (!this.hasAuth() && this.user.userType == 3) {
  237. uni.navigateTo({ url: '/pages/authentication/purchaser/index' });
  238. return;
  239. }
  240. uni.navigateTo({ url: url });
  241. },
  242. exitLogin() {
  243. let param = {
  244. appUserId: this.getUser().id
  245. };
  246. uni.showModal({
  247. title: '提示',
  248. content: '确定注销登录?',
  249. success: res => {
  250. if (res.confirm) {
  251. uni.removeStorageSync('token');
  252. uni.removeStorageSync('info');
  253. uni.removeStorageSync('menu');
  254. uni.redirectTo({ url: '/pages/login/login' });
  255. this.http.request({
  256. url: '/sp-admin/app/AppUser/logout',
  257. data: param,
  258. success: res => {
  259. }
  260. });
  261. }
  262. }
  263. });
  264. }
  265. }
  266. };
  267. </script>
  268. <style lang="scss">
  269. page {
  270. background-color: #f5f5f5;
  271. }
  272. .my_top {
  273. position: relative;
  274. overflow: hidden;
  275. image {
  276. width: 100%;
  277. }
  278. }
  279. .list {
  280. position: relative;
  281. padding: 0px 20px 10px 20px;
  282. margin-top: -196px;
  283. .user {
  284. background-color: white;
  285. padding: 20px;
  286. border-radius: 8px;
  287. color: $font-c;
  288. .head {
  289. float: left;
  290. width: 55px;
  291. height: 55px;
  292. }
  293. .con {
  294. float: left;
  295. padding-left: 15px;
  296. width: 60%;
  297. .nickName {
  298. font-size: 17px;
  299. font-weight: bold;
  300. }
  301. .tag {
  302. background-color: #6799ad;
  303. color: white;
  304. float: left;
  305. font-size: 13px;
  306. padding: 2px 6px;
  307. border-radius: 5px;
  308. margin-top: 6px;
  309. }
  310. }
  311. .edit {
  312. float: right;
  313. font-size: 20px;
  314. margin-top: 17px;
  315. }
  316. }
  317. }
  318. .exit {
  319. margin-top: 20px;
  320. background-color: white;
  321. color: #f44336;
  322. }
  323. </style>