index.vue 8.5 KB

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