index.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <view class="content-box">
  3. <view class="uni-list title-date-box" style="border: none;">
  4. <view class="uni-list-cell">
  5. <view class="uni-list-cell-db display-flex-start" style="padding-left: 10rpx;">
  6. <picker :range="arraySort" :value="sortSelect" @change="bindSortChange" class="picker-class" style="width: 35%;">
  7. <view class="uni-input display-between items-center" style="color: #707070;">{{sortSelect}}<image src="/static/arrow_down.svg" mode="aspectFit"></image></view>
  8. </picker>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="companys">
  13. <!-- <view>推荐企业</view> -->
  14. <view v-for="(company, index) in companyList" :key="index" @click="toDetail(company.id)" class="company">
  15. <image src="/static/selfCenter/add-icon.png" mode="aspectFit" class="addIcon" v-if="company.is_new"></image>
  16. <view class="title">
  17. <view class="logo">
  18. <!-- <image v-if="company.logo" :src="globalUrl + company.logo" alt="" class="logo-img" mode="aspectFit"/> -->
  19. <image v-if="company.logo" :src="company.logo" alt="" class="logo-img" mode="aspectFit"/>
  20. <image v-else src="/static/nodata.svg" alt="" class="logo-img" mode="aspectFit"/>
  21. </view>
  22. <view class="name display-around-column" style="align-items: flex-start;width:65%">
  23. <view>{{ company.name || '-'}}</view>
  24. <view class="isAdvanced" v-show="company.advanced && company.advanced !== '0'">先进制造业</view>
  25. </view>
  26. </view>
  27. <view class="info">
  28. <view class="view">
  29. <view class="info_t">亩均排序</view>
  30. <view class="name">
  31. <text v-if="company.area_order == 'X'">-</text>
  32. <text v-else>{{company.area_order}}</text>
  33. </view>
  34. </view>
  35. <view class="line"></view>
  36. <view class="view">
  37. <view class="info_t">总产值</view>
  38. {{ company.total_balance}}(亿元)
  39. <!-- <text v-if="company.capital_type == '1'">美元</text>
  40. <text v-else>人民币</text> -->
  41. </view>
  42. <view class="line"></view>
  43. <view class="view">
  44. <view class="info_t">产值增速</view>
  45. {{ company.total_ratio}}
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import md5 from "@/common/md5.js";
  54. export default {
  55. data() {
  56. return{
  57. arraySort:['全部','一至当月产值','当月产值','一至当月产值增速','当月产值增速','亩均排序'],
  58. sortSelect:'一至当月产值',
  59. companyList: [],
  60. globalUrl:getApp().globalData.shareUrl,
  61. yearVal:'',
  62. monthVal:'',
  63. titleVal:'',
  64. techVal:''
  65. }
  66. },
  67. onLoad(option) {
  68. uni.setNavigationBarTitle({
  69. title: option.title
  70. })
  71. this.yearVal = option.year;
  72. this.monthVal = option.month;
  73. this.titleVal = option.title;
  74. this.techVal = option.tech;
  75. switch (option.title){
  76. case '规上工业企业':
  77. this.getCompany(option.year,option.month,'total_balance desc')
  78. break;
  79. case '先进制造业企业':
  80. this.getAdvanced(option.year,option.month,'total_balance desc')
  81. break;
  82. case '科技创新企业':
  83. this.getTech(option.year,option.month,'total_balance desc',option.tech)
  84. break;
  85. }
  86. },
  87. methods:{
  88. bindSortChange(e){
  89. let sortObj = {
  90. '0' : '',
  91. '1' : 'total_balance desc',
  92. '2' : 'balance desc',
  93. '3' : 'total_ratio desc',
  94. '4' : 'ratio desc',
  95. '5' : 'area',
  96. }
  97. this.sortSelect = this.arraySort[e.target.value];
  98. switch (this.titleVal){
  99. case '规上工业企业':
  100. this.getCompany(this.yearVal,this.monthVal,sortObj[e.target.value])
  101. break;
  102. case '先进制造业企业':
  103. this.getAdvanced(this.yearVal,this.monthVal,sortObj[e.target.value])
  104. break;
  105. case '科技创新企业':
  106. this.getTech(this.yearVal,this.monthVal,sortObj[e.target.value],this.techVal)
  107. break;
  108. }
  109. },
  110. toDetail(id){
  111. uni.navigateTo({
  112. url:'./detail' + '?id=' + id + '&year=' + this.yearVal + '&month=' + this.monthVal
  113. })
  114. },
  115. getCompany(y,m,sort) {
  116. let md5Sign = md5(
  117. "method=" +
  118. "stat" +
  119. "&timestamp=" +
  120. getApp().globalData.globalTimestamp +
  121. "&secret=" +
  122. getApp().globalData.secret
  123. );
  124. let url =
  125. getApp().globalData.shareUrl +
  126. "api/api.php" +
  127. "?method=stat&action=standard_company_list&timestamp=" +
  128. getApp().globalData.globalTimestamp +
  129. "&sign=" +
  130. md5Sign;
  131. let postData = {
  132. year : y,
  133. month: m,
  134. order: sort
  135. };
  136. uni.request({
  137. url: url,
  138. method: "POST",
  139. header: {
  140. "content-type": "application/x-www-form-urlencoded",
  141. },
  142. data: postData,
  143. success: (res) => {
  144. if (res.data.code === 200) {
  145. this.companyList = res.data.data;
  146. // if(sort === 'area'){
  147. // this.companyList.reverse();
  148. // }
  149. }
  150. },
  151. fail: () => {
  152. console.log("连接失败");
  153. },
  154. });
  155. },
  156. getAdvanced(y,m,sort) {
  157. let md5Sign = md5(
  158. "method=" +
  159. "stat" +
  160. "&timestamp=" +
  161. getApp().globalData.globalTimestamp +
  162. "&secret=" +
  163. getApp().globalData.secret
  164. );
  165. let url =
  166. getApp().globalData.shareUrl +
  167. "api/api.php" +
  168. "?method=stat&action=advanced_company_list&timestamp=" +
  169. getApp().globalData.globalTimestamp +
  170. "&sign=" +
  171. md5Sign;
  172. let postData = {
  173. year : y,
  174. month: m,
  175. order:sort
  176. };
  177. uni.request({
  178. url: url,
  179. method: "POST",
  180. header: {
  181. "content-type": "application/x-www-form-urlencoded",
  182. },
  183. data: postData,
  184. success: (res) => {
  185. if (res.data.code === 200) {
  186. this.companyList = res.data.data;
  187. }
  188. },
  189. fail: () => {
  190. console.log("连接失败");
  191. },
  192. });
  193. },
  194. getTech(y,m,sort,techType) {
  195. let md5Sign = md5(
  196. "method=" +
  197. "stat" +
  198. "&timestamp=" +
  199. getApp().globalData.globalTimestamp +
  200. "&secret=" +
  201. getApp().globalData.secret
  202. );
  203. let url =
  204. getApp().globalData.shareUrl +
  205. "api/api.php" +
  206. "?method=stat&action=tech_company_list&timestamp=" +
  207. getApp().globalData.globalTimestamp +
  208. "&sign=" +
  209. md5Sign;
  210. let postData = {
  211. year : y,
  212. month: m,
  213. order: sort,
  214. item :techType
  215. };
  216. uni.request({
  217. url: url,
  218. method: "POST",
  219. header: {
  220. "content-type": "application/x-www-form-urlencoded",
  221. },
  222. data: postData,
  223. success: (res) => {
  224. if (res.data.code === 200) {
  225. this.companyList = res.data.data;
  226. }
  227. },
  228. fail: () => {
  229. console.log("连接失败");
  230. },
  231. });
  232. },
  233. }
  234. };
  235. </script>
  236. <style lang="scss">
  237. .content-box {
  238. display: flex;
  239. flex-direction: column;
  240. flex: 1;
  241. }
  242. .title-date-box {
  243. margin-top: 10px;
  244. border-bottom: 1px solid #d7d7d7;
  245. padding-bottom: 10px;
  246. }
  247. .picker-class {
  248. border-radius: 10rpx;
  249. padding: 10rpx;
  250. width: 180rpx;
  251. font-size: 28rpx;
  252. background: #f5f5f5;
  253. margin-left: 20rpx;
  254. }
  255. .picker-class image {
  256. width: 26rpx;
  257. height: 26rpx;
  258. }
  259. .isAdvanced {
  260. background-color: #F59A23;
  261. color: #fff;
  262. padding: 5rpx;
  263. font-size: 26rpx;
  264. border-radius: 5rpx;
  265. margin-top: 8rpx;
  266. }
  267. .companys {
  268. // margin-top: 3%;
  269. padding: 0 4%;
  270. .company {
  271. border-radius: 20rpx;
  272. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  273. padding: 2%;
  274. margin: 3% 0;
  275. position: relative;
  276. .addIcon{
  277. width: 60rpx;
  278. height: 60rpx;
  279. position: absolute;
  280. right: 20rpx;
  281. }
  282. .title {
  283. display: flex;
  284. align-items: center;
  285. .logo {
  286. margin-right: 30rpx;
  287. display: flex;
  288. justify-content: center;
  289. align-items: center;
  290. overflow: hidden;
  291. width: 150rpx;
  292. height: 100rpx;
  293. overflow: hidden;
  294. .logo-img {
  295. max-width: 100%;
  296. max-height: 100%;
  297. }
  298. }
  299. }
  300. .line {
  301. width: 2rpx;
  302. height: 70rpx;
  303. background: rgb(175, 186, 197);
  304. }
  305. .info {
  306. font-size: 24rpx;
  307. font-weight: 100;
  308. display: flex;
  309. text-align: center;
  310. justify-content: space-around;
  311. align-items: center;
  312. padding: 0 2%;
  313. margin-top: 2%;
  314. .view {
  315. margin-top: 2%;
  316. font-size: 26rpx;
  317. // .name {
  318. // color: #02a7f0;
  319. // }
  320. .info_t {
  321. margin-bottom: 10rpx;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. </style>