index.vue 8.6 KB

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