index.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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. dateYear:'',
  43. dateMonth:''
  44. };
  45. },
  46. onLoad(option) {
  47. this.active = Number(option.idx)
  48. this.dateYear = option.year
  49. this.dateMonth = option.month
  50. this.getProjectList(this.active,this.dateYear,this.dateMonth)
  51. },
  52. methods: {
  53. enterProjectDeatil(id) {
  54. if(this.active == '2'){
  55. return
  56. }
  57. uni.navigateTo({
  58. url:"/pages/metrics/projectPage/detail?id=" + id + '&year=' + this.dateYear + '&month=' + this.dateMonth
  59. });
  60. },
  61. getProjectList(tabVal,y,m){
  62. let tabObj = {
  63. 0:'在库',
  64. 1:'技改',
  65. 2:'在谈'
  66. }
  67. let md5Sign = md5(
  68. "method=" +
  69. "stat" +
  70. "&timestamp=" +
  71. getApp().globalData.globalTimestamp +
  72. "&secret=" +
  73. getApp().globalData.secret
  74. );
  75. let url =
  76. getApp().globalData.shareUrl +
  77. "api/api.php" +
  78. "?method=stat&action=project_list&timestamp=" +
  79. getApp().globalData.globalTimestamp +
  80. "&sign=" +
  81. md5Sign;
  82. uni.request({
  83. url: url,
  84. method: "POST",
  85. header: {
  86. "content-type": "application/x-www-form-urlencoded",
  87. },
  88. data: {
  89. tab : tabObj[tabVal],
  90. year:y,
  91. month:m
  92. },
  93. success: (res) => {
  94. if (res.data.code === 200) {
  95. this.projectData = res.data.data
  96. this.$forceUpdate();
  97. }
  98. },
  99. fail: () => {
  100. console.log("连接失败");
  101. },
  102. });
  103. },
  104. changeProjectTabs(idx) {
  105. let that = this;
  106. that.active = idx;
  107. switch (idx) {
  108. case 0:
  109. that.getProjectList(idx,this.dateYear,this.dateMonth);
  110. break;
  111. case 1:
  112. that.getProjectList(idx,this.dateYear,this.dateMonth);
  113. break;
  114. case 2:
  115. that.getProjectList(idx,this.dateYear,this.dateMonth);
  116. break;
  117. }
  118. },
  119. },
  120. };
  121. </script>
  122. <style lang="scss">
  123. .content-box {
  124. display: flex;
  125. flex-direction: column;
  126. flex: 1;
  127. }
  128. .policy-item-box {
  129. display: flex;
  130. justify-content: space-between;
  131. margin: 0 20rpx;
  132. margin-top: 20rpx;
  133. .policy-item-name {
  134. padding-bottom: 10rpx;
  135. font-size: 30rpx;
  136. width: 25%;
  137. text-align: center;
  138. }
  139. .active {
  140. font-weight: 600;
  141. border-bottom: 7rpx solid #02a7f0;
  142. }
  143. }
  144. .project-content {
  145. border-top: 1px solid #f2f2f2;
  146. }
  147. .pos-class {
  148. padding-left: 10rpx;
  149. margin-bottom: 10rpx;
  150. font-size: 28rpx;
  151. }
  152. .left-title {
  153. width: 20%;
  154. color: #7F7F7F;
  155. font-size: 26rpx;
  156. }
  157. .borderBottom {
  158. border-bottom: 1px solid #f2f2f2;
  159. }
  160. .marginTop20 {
  161. margin-top: 20rpx;
  162. }
  163. </style>