index.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="content-box">
  3. <view class="policy-item-box">
  4. <view v-for="(item, idx) in projectList" :key="idx" :class="{ active: active === idx }" class="policy-item-name" @click="changeProjectTabs(idx)">
  5. {{ item }}
  6. </view>
  7. </view>
  8. <view class="project-box">
  9. <view class="project-content display-around-column" v-for="(item, idx) in projectData" :key="idx"
  10. :class="{ borderBottom: idx == projectData.length - 1 }" @click="enterProjectDeatil(item.id)">
  11. <view class="display-between items-center pos-class" :class="{ marginTop20: active === 2 }" >
  12. <view style="font-size: 30rpx;">{{item.name}}</view>
  13. <image v-show="item.importent === '1'" src="/static/important_icon.png" mode="aspectFit" style="width:80rpx;height: 80rpx;"></image>
  14. </view>
  15. <view class="display-flex-start pos-class">
  16. <view class="left-title">业主名称</view>
  17. <view>{{item.owner}}</view>
  18. </view>
  19. <view class="display-flex-start pos-class" style="margin-bottom: 20rpx;" v-show="active !== 2">
  20. <view class="left-title">总投资</view>
  21. <view>{{item.investment_count || '-'}}(万元)</view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import md5 from "@/common/md5.js";
  29. export default {
  30. data() {
  31. return {
  32. swiperList: [],
  33. projectList: ["在库", "技改", "在谈"],
  34. active: 0,
  35. // projectData: new Array(5).fill({
  36. // title:"普汇中金生命科学国际合作中心",
  37. // name: "普汇中金国际控股有限公司",
  38. // maxMony: "160000(万元)",
  39. // id:'1'
  40. // }),
  41. projectData:[]
  42. };
  43. },
  44. onLoad(option) {
  45. this.active = Number(option.idx)
  46. this.getProjectList(this.active)
  47. },
  48. methods: {
  49. enterProjectDeatil(id) {
  50. if(this.active == '2'){
  51. return
  52. }
  53. uni.navigateTo({
  54. url:"/pages/metrics/projectPage/detail?id=" + id
  55. });
  56. },
  57. getProjectList(tabVal){
  58. let tabObj = {
  59. 0:'在库',
  60. 1:'技改',
  61. 2:'在谈'
  62. }
  63. let md5Sign = md5(
  64. "method=" +
  65. "stat" +
  66. "&timestamp=" +
  67. getApp().globalData.globalTimestamp +
  68. "&secret=" +
  69. getApp().globalData.secret
  70. );
  71. let url =
  72. getApp().globalData.shareUrl +
  73. "api/api.php" +
  74. "?method=stat&action=project_list&timestamp=" +
  75. getApp().globalData.globalTimestamp +
  76. "&sign=" +
  77. md5Sign;
  78. uni.request({
  79. url: url,
  80. method: "POST",
  81. header: {
  82. "content-type": "application/x-www-form-urlencoded",
  83. },
  84. data: {
  85. tab : tabObj[tabVal]
  86. },
  87. success: (res) => {
  88. if (res.data.code === 200) {
  89. this.projectData = res.data.data
  90. this.$forceUpdate();
  91. }
  92. },
  93. fail: () => {
  94. console.log("连接失败");
  95. },
  96. });
  97. },
  98. changeProjectTabs(idx) {
  99. let that = this;
  100. that.active = idx;
  101. switch (idx) {
  102. case 0:
  103. that.getProjectList(idx);
  104. break;
  105. case 1:
  106. that.getProjectList(idx);
  107. break;
  108. case 2:
  109. that.getProjectList(idx);
  110. break;
  111. }
  112. },
  113. },
  114. };
  115. </script>
  116. <style lang="scss">
  117. .content-box {
  118. display: flex;
  119. flex-direction: column;
  120. flex: 1;
  121. }
  122. .policy-item-box {
  123. display: flex;
  124. justify-content: space-between;
  125. margin: 0 20rpx;
  126. margin-top: 20rpx;
  127. .policy-item-name {
  128. padding-bottom: 10rpx;
  129. font-size: 30rpx;
  130. width: 25%;
  131. text-align: center;
  132. }
  133. .active {
  134. font-weight: 600;
  135. border-bottom: 7rpx solid #02a7f0;
  136. }
  137. }
  138. .project-content {
  139. border-top: 1px solid #f2f2f2;
  140. }
  141. .pos-class {
  142. padding-left: 10rpx;
  143. margin-bottom: 10rpx;
  144. font-size: 28rpx;
  145. }
  146. .left-title {
  147. width: 20%;
  148. color: #7F7F7F;
  149. font-size: 26rpx;
  150. }
  151. .borderBottom {
  152. border-bottom: 1px solid #f2f2f2;
  153. }
  154. .marginTop20 {
  155. margin-top: 20rpx;
  156. }
  157. </style>