index.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161
  1. <template>
  2. <view class="content-box">
  3. <view class="policy-item-box" style="justify-content: space-around;">
  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" style="padding-top: 20rpx;"
  10. :class="{ borderBottom: idx == projectData.length - 1 }" @click="enterProjectDeatil(item.id,dateYear,dateMonth)">
  11. <view class="display-between items-center pos-class">
  12. <view style="font-size: 30rpx;">{{item.name}}</view>
  13. <image v-if="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;">
  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. dateYear:'',
  36. dateMonth:'',
  37. projectData:[],
  38. // projectData: new Array(5).fill({
  39. // title:"普汇中金生命科学国际合作中心",
  40. // name: "普汇中金国际控股有限公司",
  41. // maxMony: "160000(万元)",
  42. // }),
  43. };
  44. },
  45. onLoad(option) {
  46. console.log(option)
  47. this.active = Number(option.idx)
  48. this.dateMonth = option.month;
  49. this.dateYear = option.year;
  50. this.getProjectList(this.active,this.dateYear,this.dateMonth)
  51. },
  52. methods: {
  53. enterProjectDeatil(id,y,m) {
  54. uni.navigateTo({
  55. url:"/pages/metrics/projectPage/detail?id=" + id + '&year=' + y + '&month=' + m
  56. });
  57. },
  58. getProjectList(tabVal,y,m){
  59. let tabObj = {
  60. 0:'新建',
  61. 1:'续建',
  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=importent_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. year:y,
  87. month:m
  88. },
  89. success: (res) => {
  90. if (res.data.code === 200) {
  91. this.projectData = res.data.data;
  92. this.$forceUpdate();
  93. }
  94. },
  95. fail: () => {
  96. console.log("连接失败");
  97. },
  98. });
  99. },
  100. changeProjectTabs(idx) {
  101. let that = this;
  102. that.active = idx;
  103. switch (idx) {
  104. case 0:
  105. that.getProjectList(0,that.dateYear,that.dateMonth);
  106. break;
  107. case 1:
  108. that.getProjectList(1,that.dateYear,that.dateMonth);
  109. break;
  110. }
  111. },
  112. },
  113. };
  114. </script>
  115. <style lang="scss">
  116. .content-box {
  117. display: flex;
  118. flex-direction: column;
  119. flex: 1;
  120. }
  121. .policy-item-box {
  122. display: flex;
  123. justify-content: space-between;
  124. margin: 0 20rpx;
  125. margin-top: 20rpx;
  126. .policy-item-name {
  127. padding-bottom: 10rpx;
  128. font-size: 30rpx;
  129. width: 25%;
  130. text-align: center;
  131. }
  132. .active {
  133. font-weight: 600;
  134. border-bottom: 7rpx solid #02a7f0;
  135. }
  136. }
  137. .project-content {
  138. border-top: 1px solid #f2f2f2;
  139. }
  140. .pos-class {
  141. padding-left: 10rpx;
  142. margin-bottom: 10rpx;
  143. font-size: 28rpx;
  144. }
  145. .left-title {
  146. width: 20%;
  147. color: #7F7F7F;
  148. font-size: 26rpx;
  149. }
  150. .borderBottom {
  151. border-bottom: 1px solid #f2f2f2;
  152. }
  153. </style>