index.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343
  1. <template>
  2. <view class="content main-bg">
  3. <view class="header">
  4. <image class="img" src="/static/ing7.png"></image>
  5. <view class="right">
  6. <view class="right-display">
  7. <view class="right-display-name font-color3 font-thirty-two">{{ form.veteransName }}</view>
  8. <view class="right-display-status header-long-bg font-color1">{{ change(form.veteransStatus) ? change(form.veteransStatus) : '未认证' }}</view>
  9. </view>
  10. <view class="right-name font-color3 font-twenty">{{ handle(userInfo.type) }}</view>
  11. <view class="right-login font-twenty font-color2" @click="outlogin">退出登录</view>
  12. <!-- <view class="right-position font-twenty font-color5" @click="see">查看优惠记录</view> -->
  13. </view>
  14. </view>
  15. <view class="sys" @click="goto('/pages/soldier/user/erweima')"><!--/pages/soldier/user/scanning-->
  16. <view class="icon">
  17. <image src="/static/erweima.png"></image>
  18. <!-- <u-icon name="scan" color="#2E4F1C" size="88"></u-icon> -->
  19. </view>
  20. <view class="text font-twenty font-color3">军人唯一识别码</view>
  21. </view>
  22. <!-- <view class="relatives" v-if="userInfo.type === '2'">
  23. <view class="relatives-text">
  24. <view class="text-me font-color3 font-thirty-two">我的军属</view>
  25. <view
  26. class="text-add header-long-bg font-color1 font-thirty-two"
  27. @click="goto('/pages/soldier/user/add')"
  28. >添加军属</view>
  29. </view>
  30. <view class="relatives-list" v-if="list.length > 0">
  31. <view class="list-item" v-for="item in list">
  32. <view class="item-left font-color3 font-twenty-four">{{ item.relationName }}</view>
  33. <view class="item-center">
  34. <view class="item-center-name font-color3 font-twenty-four">姓名: {{ item.userName }}</view>
  35. <view class="item-center-idCard font-color3 font-twenty-four">身份证号: {{ item.userIdcard }}</view>
  36. </view>
  37. <view class="item-right" v-if="userInfo != ''">
  38. <view class="right-btn1 font-twenty font-color2" @click="handleModify(item)">修改</view>
  39. <view class="right-btn2 font-twenty font-color5" @click="handleDel(item.userId)">删除</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-else style="padding-top: 100rpx;">
  44. <u-empty text="暂无数据" mode="list"></u-empty>
  45. </view>
  46. </view> -->
  47. <u-tabbar :list="tabBarList" :active-color="activeColor" :inactive-color="inactiveColor"
  48. :border-top="borderTop"></u-tabbar>
  49. <u-toast ref="uToast"></u-toast>
  50. </view>
  51. </template>
  52. <script>
  53. import { mapGetters } from 'vuex'
  54. import server from "@/api/index";
  55. export default {
  56. data() {
  57. return {
  58. borderTop: false,
  59. inactiveColor: '#ccc',
  60. activeColor: '#2E4F1C',
  61. name: '',
  62. status: '已认证',
  63. position: '军人',
  64. list: [],
  65. form: {},
  66. userInfo: {},
  67. }
  68. },
  69. computed: {
  70. ...mapGetters([
  71. 'tabBarList',
  72. 'role'
  73. ])
  74. },
  75. onShow(){
  76. this.userInfo = uni.getStorageSync('userInfo');
  77. // this.getUserRelationListFn();
  78. this.getListFn()
  79. },
  80. methods:{
  81. handle(type){
  82. if(type === '2'){
  83. return '军人'
  84. }else if(type === '3'){
  85. return '军属'
  86. }
  87. },
  88. change(type){
  89. if(type === '1'){
  90. return '未认证'
  91. }else if(type === '2'){
  92. return '已认证'
  93. }else if(type === '3'){
  94. return '未通过'
  95. }
  96. },
  97. handleModify(item){
  98. uni.navigateTo({
  99. url: '/pages/soldier/user/add?id='+ item.userId
  100. })
  101. },
  102. see(){
  103. uni.navigateTo({
  104. url: '/pages/merchant/home/record'
  105. })
  106. },
  107. outlogin(){
  108. let _this = this;
  109. uni.showModal({
  110. title: '提示',
  111. content: '确定退出登录吗?',
  112. success: function (res) {
  113. if (res.confirm) {
  114. uni.removeStorage({
  115. key: 'userInfo',
  116. success: function (res) {
  117. uni.removeStorage({
  118. key: 'role',
  119. });
  120. uni.removeStorage({
  121. key: 'token',
  122. success: function (res) {
  123. uni.reLaunch({
  124. url: '/pages/index/index'
  125. });
  126. }
  127. });
  128. // uni.reLaunch({
  129. // url: '/pages/index/index'
  130. // });
  131. }
  132. });
  133. } else if (res.cancel) {
  134. console.log('用户点击取消');
  135. }
  136. }
  137. });
  138. },
  139. handleDel(id){
  140. let _this = this;
  141. uni.showModal({
  142. title: '提示',
  143. content: '确定删除这个军属吗?',
  144. success: function (res) {
  145. if (res.confirm) {
  146. server.getDel(id).then(res =>{
  147. _this.$refs.uToast.show({
  148. title: '删除成功!',
  149. type: 'default',
  150. });
  151. _this.getUserRelationListFn();
  152. })
  153. } else if (res.cancel) {
  154. console.log('用户点击取消');
  155. }
  156. }
  157. });
  158. },
  159. getUserRelationListFn(){
  160. server.getUserRelationList({remark: this.userInfo.userId}).then(res =>{
  161. this.list = [];
  162. if(res){
  163. this.list = res
  164. }
  165. })
  166. },
  167. getListFn(){
  168. server.getMe(this.userInfo.userId,this.userInfo.type).then(res =>{
  169. this.form = res
  170. })
  171. },
  172. goto(url){
  173. uni.navigateTo({
  174. url
  175. })
  176. }
  177. }
  178. }
  179. </script>
  180. <style lang="scss" scoped>
  181. .content {
  182. width: 100%;
  183. min-height: 100vh;
  184. height: auto;
  185. padding: 30rpx;
  186. .header{
  187. width: 100%;
  188. height: 200rpx;
  189. background: #FFFFFF;
  190. border-radius: 24rpx;
  191. padding: 30rpx;
  192. display: flex;
  193. .img{
  194. width: 140rpx;
  195. height: 145rpx;
  196. margin-right: 20rpx;
  197. }
  198. .right{
  199. position: relative;
  200. width: calc(100% - 140rpx);
  201. padding-top: 20rpx;
  202. .right-display{
  203. display: flex;
  204. .right-display-name{
  205. letter-spacing: 3rpx;
  206. font-weight: 600;
  207. }
  208. .right-display-status{
  209. height: 40rpx;
  210. margin-left: 20rpx;
  211. border-radius: 18rpx;
  212. padding: 0rpx 16rpx;
  213. }
  214. }
  215. .right-name{
  216. padding-top: 20rpx;
  217. }
  218. .right-login{
  219. position: absolute;
  220. top: 40rpx;
  221. right: 0rpx;
  222. width: 180rpx;
  223. height: 64rpx;
  224. border-radius: 32rpx;
  225. text-align: center;
  226. line-height: 60rpx;
  227. border-radius: 32rpx;
  228. border: 1rpx solid #2E4F1C;
  229. }
  230. .right-position{
  231. position: absolute;
  232. top: 78rpx;
  233. right: 0rpx;
  234. width: 208rpx;
  235. height: 64rpx;
  236. border-radius: 32rpx;
  237. border: 2px solid #CC1019;
  238. text-align: center;
  239. line-height: 60rpx;
  240. }
  241. }
  242. }
  243. .sys{
  244. width: 100%;
  245. height: 218rpx;
  246. background: #FFFFFF;
  247. border-radius: 24rpx;
  248. margin-top: 30rpx;
  249. padding: 30rpx;
  250. .icon{
  251. height: 88rpx;
  252. text-align: center;
  253. image{
  254. width: 88rpx;
  255. height: 88rpx;
  256. }
  257. }
  258. .text{
  259. text-align: center;
  260. height: 100rpx;
  261. line-height: 100rpx;
  262. letter-spacing: 2rpx;
  263. }
  264. }
  265. .relatives{
  266. width: 100%;
  267. height: auto;
  268. overflow-y: auto;
  269. .relatives-text{
  270. width: 100%;
  271. height: 142rpx;
  272. line-height: 142rpx;
  273. display: flex;
  274. justify-content: space-between;
  275. .text-me{
  276. font-weight: 600;
  277. letter-spacing: 3rpx;
  278. }
  279. .text-add{
  280. margin-top: 35rpx;
  281. width: 182rpx;
  282. height: 72rpx;
  283. line-height: 72rpx;
  284. border-radius: 36rpx;
  285. text-align: center;
  286. letter-spacing: 1rpx;
  287. }
  288. }
  289. .relatives-list{
  290. width: 100%;
  291. height: auto;
  292. overflow-y: auto;
  293. .list-item{
  294. width: 100%;
  295. height: 176rpx;
  296. border-radius: 6rpx;
  297. border: 1rpx solid #333333;
  298. margin-bottom: 30rpx;
  299. display: flex;
  300. .item-left{
  301. width: 93rpx;
  302. height: 176rpx;
  303. line-height: 172rpx;
  304. border-right: 1rpx solid #333333;
  305. text-align: center;
  306. }
  307. .item-center{
  308. width: calc(100% - 240rpx);
  309. height: 176rpx;
  310. border-right: 1rpx solid #333333;
  311. padding: 41rpx 30rpx;
  312. .item-center-idCard{
  313. padding-top: 20rpx;
  314. }
  315. }
  316. .item-right{
  317. width: 145rpx;
  318. height: 176rpx;
  319. margin: 0 auto;
  320. padding: 30rpx 25rpx;
  321. .right-btn1{
  322. width: 96rpx;
  323. height: 48rpx;
  324. border-radius: 24rpx;
  325. border: 1px solid #2E4F1C;
  326. text-align: center;
  327. }
  328. .right-btn2{
  329. width: 96rpx;
  330. height: 48rpx;
  331. border-radius: 24rpx;
  332. margin-top: 20rpx;
  333. border: 1px solid #CC1019;
  334. text-align: center;
  335. }
  336. }
  337. }
  338. }
  339. }
  340. }
  341. </style>