index.vue 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view>
  3. <view v-if='company.length==0' style='text-align:center;transform: translateY(30%);'>
  4. <image class='image zanwu' :showLoading="true" src="../../../static/mine/company/zanwu.png"></image>
  5. <view style='font-size:13px;'>您还没有公司哦,快来添加吧~</view>
  6. <view @click="goDetailPage('/pages/mine/company/addcompany')" class='add'>去添加</view>
  7. </view>
  8. <view v-else class='content'>
  9. <!-- <view class='content1'>所属公司({{company.length}})</view> -->
  10. <view v-for='item in company' class='wrap'>
  11. <view class='flex flex-space-between'>
  12. <view>{{item.companyName}}</view>
  13. <view v-if='item.status=="已认证"' class='status passed'>{{item.status}}</view>
  14. <view v-if='item.status=="审核中"' class='status aduit'>{{item.status}}</view>
  15. <view v-if='item.status=="已驳回"' class='status reject'>{{item.status}}</view>
  16. <view v-if='item.status=="已过期"' class='status reject'>{{item.status}}</view>
  17. </view>
  18. <view class="flex">
  19. <view class="lookAccount" @click="seeAccount(item)">
  20. 查看账户
  21. </view>
  22. <view class="row2">
  23. <image v-if='item.status!="审核中"' @click='edit(item)'
  24. style='width:17px;height:17px;margin:0 10px;' src="@/static/mine/company/edit.png"></image>
  25. <image @click='delbtnAClick(item)' style='width:17px;height:17px;margin:0 10px;'
  26. src="@/static/mine/company/del.png"></image>
  27. </view>
  28. </view>
  29. </view>
  30. <view class='footer'>
  31. <view @click="goDetailPage('/pages/mine/company/addcompany')" class='newlyIncreased'>新增</view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. mapState
  39. } from 'vuex';
  40. export default {
  41. data() {
  42. return {
  43. company: []
  44. }
  45. },
  46. computed: {
  47. ...mapState(['hasLogin', 'userInfo']),
  48. },
  49. onLoad() {
  50. var _this = this;
  51. if (!this.hasLogin) {
  52. uni.$u.route('/pages/public/login');
  53. }
  54. },
  55. onShow() {
  56. this.getList()
  57. },
  58. methods: {
  59. seeAccount(item){
  60. uni.$u.route("/pages/mine/myAccount/index?id=" + item.id + "&companyId=" + item.id)
  61. },
  62. goDetailPage(src) {
  63. var that=this
  64. if(src=='/pages/mine/company/addcompany'){
  65. this.$request.baseRequest('get', '/cargoOwnerInfo/firstAuthentication', {
  66. phone: this.userInfo.phone,
  67. }).then(res => {
  68. if (res.data.authenticationStatus == '已认证') {
  69. uni.$u.route(src);
  70. }else{
  71. that.$refs.uToast.show({
  72. type: 'error',
  73. message: "请先完成个人认证"
  74. })
  75. }
  76. })
  77. }else{
  78. uni.$u.route(src);
  79. }
  80. },
  81. edit(item) {
  82. this.goDetailPage('/pages/mine/company/editcompany?id=' + item.id)
  83. },
  84. delbtnAClick(val) {
  85. uni.$u.throttle(this.del(val), 1000)
  86. },
  87. del(item) {
  88. var _this = this
  89. uni.showModal({ title: '友情提示',
  90.     content: '确认删除公司吗?',
  91.     success: function (res) {
  92. if (res.confirm) {
  93. uni.showLoading({
  94. title: '加载中',
  95. mask: true
  96. })
  97. _this.$request.baseRequest('post', '/companyInfo/api/deleteCompany', {
  98. id: item.id
  99. }).then(res => {
  100. uni.hideLoading()
  101. uni.$u.toast('删除成功')
  102. _this.getList()
  103. })
  104. .catch(res => {
  105. uni.hideLoading()
  106. uni.showToast({
  107. title: res.message,
  108. icon: 'none',
  109. duration: 2000
  110. })
  111. });
  112. } else if (res.cancel) {
  113. }    
  114. }
  115. });
  116. },
  117. goDetailPage(src) {
  118. uni.$u.route(src);
  119. },
  120. getList() {
  121. uni.showLoading({
  122. title: '加载中',
  123. mask: true
  124. })
  125. var _this = this
  126. this.$request.baseRequest('get', '/companyInfo/selectCompany', {
  127. commonId: this.userInfo.id
  128. }).then(res => {
  129. uni.hideLoading()
  130. this.company = res.data
  131. })
  132. .catch(res => {
  133. uni.hideLoading()
  134. uni.showToast({
  135. title: res.message,
  136. icon: 'none',
  137. duration: 2000
  138. })
  139. });
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. page {
  146. background: #F5F6FA;
  147. }
  148. .zanwu {
  149. width: 235px;
  150. height: 235px;
  151. }
  152. .add {
  153. width: 106px;
  154. height: 42px;
  155. margin: 36px auto 0;
  156. color: #fff;
  157. // background: url(../../../static/mine/company/Mask@3x.png);
  158. background: #2772FB ;
  159. border-radius: 44rpx;
  160. background-size: 100%;
  161. line-height: 42px;
  162. }
  163. .wrap {
  164. background: #fff;
  165. border-radius: 10rpx;
  166. padding: 24rpx;
  167. box-sizing: border-box;
  168. margin-top: 20rpx;
  169. .lookAccount {
  170. color: #2772FB;
  171. font-size: 26rpx;
  172. margin-top: 112rpx;
  173. width: 50%;
  174. }
  175. .row2 {
  176. margin-top: 112rpx;
  177. width: 50%;
  178. display: flex;
  179. justify-content: flex-end;
  180. }
  181. }
  182. .status {
  183. font-size: 26rpx;
  184. padding: 5rpx 18rpx;
  185. color: #fff;
  186. border-radius: 20rpx;
  187. }
  188. .status.passed {
  189. background: #25E491;
  190. }
  191. .status.aduit {
  192. background: #FE8031;
  193. }
  194. .status.reject {
  195. background: #FC5A51;
  196. }
  197. .content {
  198. padding: 20rpx;
  199. }
  200. .footer {
  201. position: fixed;
  202. background: #fff;
  203. width: 100%;
  204. bottom: 0;
  205. left: 0;
  206. padding: 15px 15px 30px;
  207. box-sizing: border-box;
  208. }
  209. .newlyIncreased {
  210. width: 100%;
  211. height: 80rpx;
  212. margin: 0 auto;
  213. text-align: center;
  214. color: #fff;
  215. background: #2772FB;
  216. background-size: 100%;
  217. border-radius: 50rpx;
  218. display: flex;
  219. align-items: center;
  220. justify-content: center;
  221. }
  222. </style>