index.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331
  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;">
  22. <view>{{ company.name || '-'}}</view>
  23. <view class="isAdvanced" v-show="company.advanced">先进制造业</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. console.log(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
  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. }
  146. },
  147. fail: () => {
  148. console.log("连接失败");
  149. },
  150. });
  151. },
  152. getAdvanced(y,m,sort) {
  153. let md5Sign = md5(
  154. "method=" +
  155. "stat" +
  156. "&timestamp=" +
  157. getApp().globalData.globalTimestamp +
  158. "&secret=" +
  159. getApp().globalData.secret
  160. );
  161. let url =
  162. getApp().globalData.shareUrl +
  163. "api/api.php" +
  164. "?method=stat&action=advanced_company_list&timestamp=" +
  165. getApp().globalData.globalTimestamp +
  166. "&sign=" +
  167. md5Sign;
  168. let postData = {
  169. year : y,
  170. month: m,
  171. order:'area'
  172. };
  173. uni.request({
  174. url: url,
  175. method: "POST",
  176. header: {
  177. "content-type": "application/x-www-form-urlencoded",
  178. },
  179. data: postData,
  180. success: (res) => {
  181. if (res.data.code === 200) {
  182. this.companyList = res.data.data;
  183. }
  184. },
  185. fail: () => {
  186. console.log("连接失败");
  187. },
  188. });
  189. },
  190. getTech(y,m,sort,techType) {
  191. let md5Sign = md5(
  192. "method=" +
  193. "stat" +
  194. "&timestamp=" +
  195. getApp().globalData.globalTimestamp +
  196. "&secret=" +
  197. getApp().globalData.secret
  198. );
  199. let url =
  200. getApp().globalData.shareUrl +
  201. "api/api.php" +
  202. "?method=stat&action=tech_company_list&timestamp=" +
  203. getApp().globalData.globalTimestamp +
  204. "&sign=" +
  205. md5Sign;
  206. let postData = {
  207. year : y,
  208. month: m,
  209. order: sort,
  210. item :techType
  211. };
  212. uni.request({
  213. url: url,
  214. method: "POST",
  215. header: {
  216. "content-type": "application/x-www-form-urlencoded",
  217. },
  218. data: postData,
  219. success: (res) => {
  220. if (res.data.code === 200) {
  221. this.companyList = res.data.data;
  222. }
  223. },
  224. fail: () => {
  225. console.log("连接失败");
  226. },
  227. });
  228. },
  229. }
  230. };
  231. </script>
  232. <style lang="scss">
  233. .content-box {
  234. display: flex;
  235. flex-direction: column;
  236. flex: 1;
  237. }
  238. .title-date-box {
  239. margin-top: 10px;
  240. border-bottom: 1px solid #d7d7d7;
  241. padding-bottom: 10px;
  242. }
  243. .picker-class {
  244. border-radius: 10rpx;
  245. padding: 10rpx;
  246. width: 180rpx;
  247. font-size: 28rpx;
  248. background: #f5f5f5;
  249. margin-left: 20rpx;
  250. }
  251. .picker-class image {
  252. width: 26rpx;
  253. height: 26rpx;
  254. }
  255. .isAdvanced {
  256. background-color: #F59A23;
  257. color: #fff;
  258. padding: 5rpx;
  259. font-size: 26rpx;
  260. border-radius: 5rpx;
  261. margin-top: 8rpx;
  262. }
  263. .companys {
  264. // margin-top: 3%;
  265. padding: 0 4%;
  266. .company {
  267. border-radius: 20rpx;
  268. box-shadow: rgba(0, 0, 0, 0.35) 0rpx 5rpx 15rpx;
  269. padding: 2%;
  270. margin: 3% 0;
  271. position: relative;
  272. .addIcon{
  273. width: 60rpx;
  274. height: 60rpx;
  275. position: absolute;
  276. right: 20rpx;
  277. }
  278. .title {
  279. display: flex;
  280. align-items: center;
  281. .logo {
  282. margin-right: 30rpx;
  283. display: flex;
  284. justify-content: center;
  285. align-items: center;
  286. overflow: hidden;
  287. width: 150rpx;
  288. height: 100rpx;
  289. overflow: hidden;
  290. .logo-img {
  291. max-width: 100%;
  292. max-height: 100%;
  293. }
  294. }
  295. }
  296. .line {
  297. width: 2rpx;
  298. height: 70rpx;
  299. background: rgb(175, 186, 197);
  300. }
  301. .info {
  302. font-size: 24rpx;
  303. font-weight: 100;
  304. display: flex;
  305. text-align: center;
  306. justify-content: space-around;
  307. align-items: center;
  308. padding: 0 2%;
  309. margin-top: 2%;
  310. .view {
  311. margin-top: 2%;
  312. font-size: 26rpx;
  313. // .name {
  314. // color: #02a7f0;
  315. // }
  316. .info_t {
  317. margin-bottom: 10rpx;
  318. }
  319. }
  320. }
  321. }
  322. }
  323. </style>