my_grain_pulse.vue 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391
  1. <template>
  2. <view style='margin-bottom:70px;'>
  3. <scroll-view scroll-x="true" scroll-with-animation="true" class='list-type'>
  4. <view v-for='item in searchTypes' @click='changetype(item)' :class='mainBusinessType==item.name?"Semibold active":"Regular"' class="typeitem">{{item.name}}</view>
  5. </scroll-view>
  6. <view v-if='datalist.length>0' v-for='item in datalist' @click='todetails(item)' class="listitem">
  7. <view class="flex" v-if='mainBusinessType=="我的企业"'>
  8. <image style='width:144px;height:96px;flex:1;' class='listitem-left' :src="item.attachmentAddress" mode=""></image>
  9. <view style='flex:2;' class="listitem-right">
  10. <view class="flex justify-between">
  11. <view class="companyname Medium">{{item.compName}}</view>
  12. <view v-if='item.status=="待审核"' class='listitemStatus audit Regular'>审核中</view>
  13. <view v-if='item.status=="已驳回"' class='listitemStatus notPass Regular'>未通过</view>
  14. <view v-if='item.status=="已通过"' class='listitemStatus pass Regular'>已通过</view>
  15. </view>
  16. <view class='companylocation flex align-item-center Regular'>
  17. <image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
  18. {{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}
  19. </view>
  20. <view>
  21. <view v-if='item.showFlag==2' @click.stop='showHidden(item)' class="button Regular">显示</view>
  22. <view v-if='item.showFlag==1' @click.stop='showHidden(item)' class="button Regular">隐藏</view>
  23. <view @click.stop='edit(item)' class="button Regular">编辑</view>
  24. <view @click.stop='del(item)' class="button Regular">删除</view>
  25. </view>
  26. </view>
  27. </view>
  28. <view v-else>
  29. <view class="flex">
  30. <image style='width:144px;height:96px;flex:1;' class='listitem-left' :src="item.attachmentAddress" mode=""></image>
  31. <view style='flex:2;' class="listitem-right">
  32. <view class="flex justify-between">
  33. <view class="companyname Medium">{{item.compName}}</view>
  34. <image style='width:35rpx;height:25rpx;position:relative;top:5px;' :src="status1?'../../static/img/liangmai/shoucang1.png':'../../static/img/liangmai/my_shoucang.png'" mode=""></image>
  35. </view>
  36. <view class='Regular introduce'>{{item.companyProfile}}</view>
  37. </view>
  38. </view>
  39. <view class="flex align-item-center justify-between">
  40. <view class='companylocation flex align-item-center Regular'>
  41. <image class='location' src="../../static/img/liangmai/icon_ditu.png" mode=""></image>
  42. {{item.province}}{{item.city}}{{item.area}}{{item.detailedAddress}}
  43. </view>
  44. <view class='distance Regular'>{{item._metre}}</view>
  45. </view>
  46. </view>
  47. </view>
  48. <view style='padding:10px;text-align:center;' v-if='datalist.length==0'>
  49. 当前暂无信息
  50. </view>
  51. <view v-show='mainBusinessType=="我的企业"' class='exitloginwrap'>
  52. <button @click.stop='enterclick()' class='exitlogin'>新增</button>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. mapState
  59. } from 'vuex';
  60. export default {
  61. components: {
  62. },
  63. data() {
  64. return {
  65. status:0,
  66. mainBusinessType:'我的企业',
  67. pageSize: 10,
  68. currentPage: 1,
  69. datalist:[],
  70. status1:true,
  71. isLoadMore:false,
  72. position:{},
  73. searchTypes:[
  74. {name:'我的企业',value:'1'},{name:'我的收藏',value:'1'}
  75. ],
  76. }
  77. },
  78. onPullDownRefresh() {
  79. this.getList()
  80. setTimeout(function () {
  81. uni.stopPullDownRefresh(); //关闭下拉刷新
  82. }, 1000);
  83. },
  84. onShow(){
  85. this.getList()
  86. uni.getStorage({
  87. key: 'setLocaltion',
  88. success: (res) => {
  89. console.log(res.data)
  90. this.position = res.data
  91. // uni.removeStorage({
  92. // key: 'setLocaltion'
  93. // })
  94. },
  95. })
  96. },
  97. onLoad(){
  98. },
  99. onReachBottom() { //上拉触底函数
  100. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  101. this.currentPage += 1
  102. }
  103. this.getData()
  104. },
  105. computed: {
  106. ...mapState(['hasLogin', 'userInfo'])
  107. },
  108. methods: {
  109. getData(){
  110. this.isLoadMore=true
  111. if(this.mainBusinessType=='我的企业'){
  112. this.$api.doRequest('get','/settledCompanyInfo/selectSettledCompanyInfo',{mainBusinessType:'',pageSize: this.pageSize,
  113. currentPage: this.currentPage,pcFlag:2,createPhone:this.userInfo.phone}).then(res => {
  114. if(res.data.code==200){
  115. this.isLoadMore=false
  116. this.datalist=this.datalist.concat(res.data.data.records)
  117. }
  118. })
  119. }else{
  120. this.$api.doRequest('get','/settledCompanyInfo/myCollection',{loginPhone:this.userInfo.phone,pageSize:this.pageSize,
  121. currentPage: this.currentPage,pcFlag:2}).then(res => {
  122. console.log("myCollection",res)
  123. if(res.data.code==200){
  124. this.datalist=this.datalist.concat(res.data.data.records)
  125. let lat2 =this.position.location.split(',')[1];
  126. let lng2 = this.position.location.split(',')[0];
  127. for(var i=0;i<this.datalist.length;i++){
  128. this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
  129. }
  130. }
  131. })
  132. }
  133. },
  134. getList(){
  135. this.isLoadMore=true
  136. if(this.mainBusinessType=='我的企业'){
  137. this.$api.doRequest('get','/settledCompanyInfo/selectSettledCompanyInfo',{mainBusinessType:'',pageSize: this.pageSize,
  138. currentPage: this.currentPage,pcFlag:2,createPhone:this.userInfo.phone}).then(res => {
  139. if(res.data.code==200){
  140. this.isLoadMore=false
  141. this.datalist=res.data.data.records
  142. }
  143. })
  144. }else{
  145. this.$api.doRequest('get','/settledCompanyInfo/myCollection',{loginPhone:this.userInfo.phone,pageSize:this.pageSize,
  146. currentPage: this.currentPage,pcFlag:2}).then(res => {
  147. console.log("myCollection",res)
  148. if(res.data.code==200){
  149. this.datalist=res.data.data.records
  150. let lat2 =this.position.location.split(',')[1];
  151. let lng2 = this.position.location.split(',')[0];
  152. for(var i=0;i<this.datalist.length;i++){
  153. this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
  154. }
  155. }
  156. })
  157. }
  158. },
  159. del(item){
  160. uni.showModal({
  161. content: "确定删除该企业?",
  162. showCancel: true,
  163. confirmText: '提交',
  164. success: function(res) {
  165. if (res.confirm) {
  166. this.$api.doRequest('post','/settledCompanyInfo/api/deleteSettledCompanyInfo',{id:item.id}).then(res => {
  167. if(res.data.code==200){
  168. this.$api.msg('删除成功')
  169. }else{
  170. this.$api.msg('删除失败')
  171. }
  172. })
  173. }
  174. },
  175. })
  176. },
  177. edit(item){
  178. // if(item.status=='已驳回'||item.status=='待审核'){
  179. uni.navigateTo({
  180. url:'/pages/grain_pulse/editcompany?id='+item.id
  181. })
  182. // }
  183. },
  184. showHidden(item){
  185. this.$api.doRequest('post','/settledCompanyInfo/api/showHidden',{id:item.id}).then(res => {
  186. if(res.data.code==200){
  187. if(item.showFlag==1){
  188. item.showFlag=2
  189. this.$api.msg('隐藏成功')
  190. }else{
  191. item.showFlag=1
  192. this.$api.msg('显示成功')
  193. }
  194. }else{
  195. if(item.showFlag==1){
  196. this.$api.msg('隐藏失败')
  197. }else{
  198. this.$api.msg('显示失败')
  199. }
  200. }
  201. })
  202. },
  203. friendcircle(){
  204. uni.navigateTo({
  205. url:'/pages/grain_pulse/friendcircle'
  206. })
  207. },
  208. todetails(item) {
  209. uni.navigateTo({
  210. url: '/pages/grain_pulse/details?id=' + item.id
  211. })
  212. },
  213. naviageToPage(item){
  214. uni.navigateTo({
  215. url:item
  216. })
  217. },
  218. enterclick(){
  219. //入驻
  220. uni.navigateTo({
  221. url:'/pages/grain_pulse/enter'
  222. })
  223. },
  224. changetype(item){
  225. this.mainBusinessType=item.name
  226. this.getList()
  227. }
  228. }
  229. }
  230. </script>
  231. <style scoped>
  232. /* 《--头部 */
  233. .header{
  234. padding:0 12.5px;
  235. background:#fff;
  236. border-radius:0 0 10px 10px;
  237. }
  238. /* 头部--》 */
  239. /* 《--定位 */
  240. .location{
  241. width:15.5px;height:17.5px;margin-right:2.5px;
  242. }
  243. .locationwrap{
  244. font-size:16px;
  245. }
  246. /* 定位 --》 */
  247. /* 《--分布 */
  248. .map{
  249. padding:8.5px 0;
  250. }
  251. .cangku{
  252. width:16.5px;height:16.5px;margin-right:5px;
  253. }
  254. .distribution{
  255. background:#F5F6FA;
  256. width: 71.5px;
  257. height:32px;
  258. border-radius:15px;
  259. font-size:12px;
  260. }
  261. /* 分布--》 */
  262. /* 《--搜索 */
  263. .cu-bar .search-form{
  264. background:#F5F6F9;
  265. margin:0;
  266. margin-bottom:18px;
  267. padding:10px 18px;
  268. }
  269. .icon-scarch{
  270. width:15px;
  271. height:15px;
  272. margin-right:5px;
  273. }
  274. /* 搜索--》 */
  275. /* 《--内容 */
  276. .content{
  277. margin-top:13px;
  278. }
  279. /* 内容--》 */
  280. /* 《--类型 */
  281. .list-type{
  282. background: #fff;
  283. width:100vw;
  284. padding-top:5px;
  285. height:49px;
  286. overflow-x: scroll;
  287. white-space: nowrap;
  288. }
  289. .typeitem{
  290. margin:10px;
  291. position:relative;
  292. display:inline-block;
  293. padding-bottom:10px;
  294. font-size:17px;
  295. }
  296. .typeitem.active:after{
  297. content:'';
  298. display:block;
  299. position:absolute;
  300. height:3px;
  301. bottom:0;
  302. background:#22C572;
  303. width:18px;
  304. left:50%;
  305. transform: translateX(-50%);
  306. }
  307. /* 类型--》 */
  308. /* 《--数据 */
  309. .listitem{
  310. background:#fff;
  311. margin:10px;
  312. padding:15px 19px;
  313. border-radius:10px;
  314. }
  315. .listitem-left{
  316. width: 400rpx;
  317. height: 200rpx;
  318. border-radius: 5px;
  319. }
  320. .listitem-right{
  321. padding-left:5px;
  322. }
  323. .companyname{
  324. font-size:14px;
  325. color:#333;
  326. }
  327. .introduce{
  328. font-size:12px;
  329. color:#676E80;
  330. }
  331. .companylocation{
  332. color:#676E80;
  333. font-size:12px;
  334. margin-top:8px;
  335. padding:4px 9px;
  336. }
  337. .distance{
  338. color:#AFB3BF;
  339. padding:4px;
  340. margin-top:8px;
  341. font-size: 12px;
  342. }
  343. /* 数据--》 */
  344. .button{
  345. display:inline-block;
  346. border:1px solid #CDCDCD;
  347. padding:6px 15px;
  348. border-radius:15px;
  349. margin:5px 3px;
  350. }
  351. .listitemStatus{
  352. margin-left:2px;
  353. width: 150rpx;
  354. }
  355. .listitemStatus.audit{
  356. color:#FE6430;
  357. }
  358. .listitemStatus.notPass{
  359. color:#FB1E1E;
  360. }
  361. .listitemStatus.pass{
  362. color:#22C572;
  363. }
  364. .exitloginwrap{
  365. position:fixed;
  366. bottom:0;
  367. left:0;
  368. width:100%;
  369. padding-bottom:20px;
  370. }
  371. .exitlogin{
  372. width:90%;
  373. background:#22C572;
  374. border-radius:30px;
  375. color:#fff;
  376. font-size:17px;
  377. }
  378. .exitlogin:after{
  379. border:none;
  380. }
  381. </style>