index.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="mine-container" :style="{height: `${windowHeight}px`}">
  3. <!--顶部个人信息栏-->
  4. <view class="header-section">
  5. <view class="flex padding justify-between">
  6. <view class="flex align-center">
  7. <view v-if="!avatar" class="cu-avatar xl round bg-white">
  8. <view class="iconfont icon-people text-gray icon"></view>
  9. </view>
  10. <image v-if="avatar" @click="handleToAvatar" :src="avatar" class="cu-avatar xl round"
  11. mode="widthFix">
  12. </image>
  13. <view v-if="!userinfo" @click="handleToLogin" class="login-tip">
  14. 点击登录
  15. </view>
  16. <view v-if="userinfo" @click="handleToInfo" class="user-info">
  17. <view class="u_title">
  18. {{ userinfo.nickName}}
  19. </view>
  20. <view style="font-size: 26rpx;" class="u_title">
  21. {{ userinfo.phonenumber}}
  22. </view>
  23. </view>
  24. </view>
  25. <view v-if="userinfo" @click="handleLogout" class="flex align-center">
  26. <text>退出</text>
  27. <view class="iconfont icon-right"></view>
  28. </view>
  29. <!-- <view v-if="userinfo" @click="setPassWord" class="flex align-center">
  30. <text>修改密码</text>
  31. <view class="iconfont icon-right"></view>
  32. </view> -->
  33. </view>
  34. </view>
  35. <view class="padding pb-0">
  36. <uni-section v-if="hasPermissions" title="入库单" type="line">
  37. <view class="flex bg-white ">
  38. <view v-if="hasPermissions" @click="goEntry('PRO')" class="flex-sub text-center padding-sm">
  39. <uni-icons color="#007aff" type="person-filled" size="36"></uni-icons><br>
  40. <text class="font-24">生产入库</text>
  41. </view>
  42. <view v-if="hasPermissions" @click="goOrder('PRO')" class="flex-sub text-center padding-sm">
  43. <uni-icons color="#007aff" type="person-filled" size="36"></uni-icons><br>
  44. <text class="font-24">入库单</text>
  45. </view>
  46. <view v-if="hasPermissions" @click="goEntry('OQC')" class="flex-sub text-center padding-sm">
  47. <uni-icons color="#007aff" type="calendar-filled" size="36"></uni-icons><br>
  48. <text class="font-24">品检入库</text>
  49. </view>
  50. <view v-if="hasPermissions" @click="goEntry('FTB')" class="flex-sub text-center padding-sm">
  51. <uni-icons color="#007aff" type="locked-filled" size="36"></uni-icons><br>
  52. <text class="font-24">翻箱入库</text>
  53. </view>
  54. </view>
  55. </uni-section>
  56. <view class="margin-top-sm"></view>
  57. <uni-section v-if="hasPermissions" title="退库单" type="line">
  58. <view class="flex bg-white ">
  59. <view v-if="hasPermissions" @click="goEntry('OQCRET')" class="flex-sub text-center padding-sm">
  60. <uni-icons color="#007aff" type="locked-filled" size="36"></uni-icons><br>
  61. <text class="font-24">品检退库</text>
  62. </view>
  63. <view v-if="hasPermissions" @click="goEntry('FTBRET')" class="flex-sub text-center padding-sm">
  64. <uni-icons color="#007aff" type="person-filled" size="36"></uni-icons><br>
  65. <text class="font-24">翻箱退库</text>
  66. </view>
  67. <!-- <view @click="settakestock" class="flex-sub text-center padding-sm">
  68. <uni-icons color="#007aff" type="calendar-filled" size="36"></uni-icons><br>
  69. <text class="font-12">客诉退库</text>
  70. </view> -->
  71. </view>
  72. </uni-section>
  73. </view>
  74. <view class="padding ">
  75. </view>
  76. </view>
  77. </view>
  78. </template>
  79. <script>
  80. import storage from '@/utils/storage'
  81. export default {
  82. data() {
  83. return {
  84. userinfo: this.$store.state.user.userinfo,
  85. name: this.$store.state.user.name,
  86. version: getApp().globalData.config.appInfo.version,
  87. hasPermissions: false
  88. }
  89. },
  90. computed: {
  91. avatar() {
  92. return this.$store.state.user.avatar
  93. },
  94. windowHeight() {
  95. return uni.getSystemInfoSync().windowHeight - 50
  96. },
  97. permissions() {
  98. return this.$store.state.user.permissions
  99. },
  100. roles() {
  101. return this.$store.state.user.roles
  102. }
  103. },
  104. onLoad() {
  105. if(!this.userinfo||this.userinfo.nickName){
  106. this.$store.dispatch('GetInfo').then(res=>{
  107. this.userinfo=this.$store.state.user.userinfo
  108. this.checkUserPermissions()
  109. })
  110. }else{
  111. this.checkUserPermissions()
  112. }
  113. },
  114. onShow() {},
  115. methods: {
  116. checkUserPermissions() {
  117. // console.log(this.permissions,'this.permissions')
  118. this.hasPermissions = this.permissions.includes('product:whse:info:query')||this.roles.includes('admin');
  119. // console.log(this.hasPermissions,'hasPermissions')
  120. },
  121. goEntry(type) {
  122. // this.$tab.navigateTo('/pages/finished-product/entry/index?type='+type)
  123. window.location.href=window.location.origin+'/pages/finished-product/entry/index?type='+type
  124. },
  125. goOrder(type) {
  126. this.$tab.navigateTo('/pages/finished-product/entry/order')
  127. },
  128. handleToInfo() {
  129. this.$tab.navigateTo('/pages/mine/info/index')
  130. },
  131. setPassWord() {
  132. this.$tab.navigateTo('/pages/mine/pwd/index')
  133. },
  134. handleToEditInfo(item) {
  135. this.$tab.navigateTo('/pages/wagesView?id=' + item.id)
  136. },
  137. handleToSetting() {
  138. this.$tab.navigateTo('/pages/mine/setting/index')
  139. },
  140. handleToLogin() {
  141. this.$tab.reLaunch('/pages/login')
  142. },
  143. handleToAvatar() {
  144. this.$tab.navigateTo('/pages/mine/avatar/index')
  145. },
  146. handleLogout() {
  147. this.$modal.confirm('确定注销并退出系统吗?').then(() => {
  148. this.$store.dispatch('LogOut').then(() => {
  149. this.$tab.reLaunch('/pages/login')
  150. })
  151. })
  152. },
  153. handleHelp() {
  154. this.$tab.navigateTo('/pages/mine/help/index')
  155. },
  156. handleAbout() {
  157. this.$tab.navigateTo('/pages/mine/about/index')
  158. },
  159. handleJiaoLiuQun() {
  160. this.$modal.showToast('QQ群:①133713780、②146013835')
  161. },
  162. handleBuilding() {
  163. this.$modal.showToast('模块建设中~')
  164. }
  165. }
  166. }
  167. </script>
  168. <style lang="scss">
  169. page {
  170. background-color: #f5f6f7;
  171. }
  172. .setbox {
  173. padding: 30rpx;
  174. }
  175. .mine-container {
  176. width: 100%;
  177. height: 100%;
  178. .header-section {
  179. padding: 15px 15px 45px 15px;
  180. background: $uni-color-primary;
  181. color: white;
  182. .login-tip {
  183. font-size: 18px;
  184. margin-left: 10px;
  185. }
  186. .cu-avatar {
  187. border: 2px solid #eaeaea;
  188. .icon {
  189. font-size: 40px;
  190. }
  191. }
  192. .user-info {
  193. margin-left: 15px;
  194. .u_title {
  195. font-size: 16px;
  196. line-height: 30px;
  197. }
  198. }
  199. }
  200. .content-section {
  201. position: relative;
  202. top: -50px;
  203. .mine-actions {
  204. margin: 15px 15px;
  205. padding: 20px 0px;
  206. border-radius: 8px;
  207. background-color: white;
  208. .action-item {
  209. .icon {
  210. font-size: 28px;
  211. }
  212. .text {
  213. display: block;
  214. font-size: 13px;
  215. margin: 8px 0px;
  216. }
  217. }
  218. }
  219. }
  220. }
  221. </style>