my_grain_pulse.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  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 class='listitem-left' :src="item.attachmentAddress" mode=""></image>
  9. <view 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 class='listitem-left' :src="item.attachmentAddress" mode=""></image>
  31. <view class="listitem-right">
  32. <view class="flex justify-between">
  33. <view class="companyname Medium">{{item.compName}}</view>
  34. <image style='width:12px;height:12px;' :src="status1?'../../static/img/liangmai/my_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.getList()
  104. },
  105. computed: {
  106. ...mapState(['hasLogin', 'userInfo'])
  107. },
  108. methods: {
  109. getList(){
  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=res.data.data.records
  117. }
  118. })
  119. }else{
  120. this.$api.doRequest('get','/settledCompanyInfo/myCollection',{phone:this.userInfo.phone,pageSize:this.pageSize,
  121. currentPage: this.currentPage,pcFlag:2}).then(res => {
  122. if(res.data.code==200){
  123. this.datalist=res.data.data.records
  124. let lat2 =this.position.location.split(',')[1];
  125. let lng2 = this.position.location.split(',')[0];
  126. for(var i=0;i<this.datalist.length;i++){
  127. this.datalist[i]._metre=this.utils.getDistance(this.datalist[i].latitude,this.datalist[i].longitude,lat2,lng2)
  128. }
  129. }
  130. })
  131. }
  132. },
  133. del(item){
  134. this.$api.doRequest('post','/settledCompanyInfo/api/deleteSettledCompanyInfo',{id:item.id}).then(res => {
  135. if(res.data.code==200){
  136. this.$api.msg('删除成功')
  137. }else{
  138. this.$api.msg('删除失败')
  139. }
  140. })
  141. },
  142. edit(item){
  143. if(item.status=='已驳回'||item.status=='已通过'){
  144. uni.navigateTo({
  145. url:'/pages/grain_pulse/editcompany?id='+item.id
  146. })
  147. }
  148. },
  149. showHidden(item){
  150. this.$api.doRequest('post','/settledCompanyInfo/api/showHidden',{id:item.id}).then(res => {
  151. if(res.data.code==200){
  152. if(item.showFlag==1){
  153. item.showFlag=2
  154. this.$api.msg('隐藏成功')
  155. }else{
  156. item.showFlag=1
  157. this.$api.msg('显示成功')
  158. }
  159. }else{
  160. if(item.showFlag==1){
  161. this.$api.msg('隐藏失败')
  162. }else{
  163. this.$api.msg('显示失败')
  164. }
  165. }
  166. })
  167. },
  168. friendcircle(){
  169. uni.navigateTo({
  170. url:'/pages/grain_pulse/friendcircle'
  171. })
  172. },
  173. todetails(item) {
  174. uni.navigateTo({
  175. url: '/pages/grain_pulse/details?id=' + item.id
  176. })
  177. },
  178. naviageToPage(item){
  179. uni.navigateTo({
  180. url:item
  181. })
  182. },
  183. enterclick(){
  184. //入驻
  185. uni.navigateTo({
  186. url:'/pages/grain_pulse/enter'
  187. })
  188. },
  189. changetype(item){
  190. this.mainBusinessType=item.name
  191. this.getList()
  192. }
  193. }
  194. }
  195. </script>
  196. <style scoped>
  197. /* 《--头部 */
  198. .header{
  199. padding:0 12.5px;
  200. background:#fff;
  201. border-radius:0 0 10px 10px;
  202. }
  203. /* 头部--》 */
  204. /* 《--定位 */
  205. .location{
  206. width:15.5px;height:17.5px;margin-right:2.5px;
  207. }
  208. .locationwrap{
  209. font-size:16px;
  210. }
  211. /* 定位 --》 */
  212. /* 《--分布 */
  213. .map{
  214. padding:8.5px 0;
  215. }
  216. .cangku{
  217. width:16.5px;height:16.5px;margin-right:5px;
  218. }
  219. .distribution{
  220. background:#F5F6FA;
  221. width: 71.5px;
  222. height:32px;
  223. border-radius:15px;
  224. font-size:12px;
  225. }
  226. /* 分布--》 */
  227. /* 《--搜索 */
  228. .cu-bar .search-form{
  229. background:#F5F6F9;
  230. margin:0;
  231. margin-bottom:18px;
  232. padding:10px 18px;
  233. }
  234. .icon-scarch{
  235. width:15px;
  236. height:15px;
  237. margin-right:5px;
  238. }
  239. /* 搜索--》 */
  240. /* 《--内容 */
  241. .content{
  242. margin-top:13px;
  243. }
  244. /* 内容--》 */
  245. /* 《--类型 */
  246. .list-type{
  247. background: #fff;
  248. width:100vw;
  249. padding-top:5px;
  250. height:49px;
  251. overflow-x: scroll;
  252. white-space: nowrap;
  253. }
  254. .typeitem{
  255. margin:10px;
  256. position:relative;
  257. display:inline-block;
  258. padding-bottom:10px;
  259. font-size:17px;
  260. }
  261. .typeitem.active:after{
  262. content:'';
  263. display:block;
  264. position:absolute;
  265. height:3px;
  266. bottom:0;
  267. background:#22C572;
  268. width:18px;
  269. left:50%;
  270. transform: translateX(-50%);
  271. }
  272. /* 类型--》 */
  273. /* 《--数据 */
  274. .listitem{
  275. background:#fff;
  276. margin:10px;
  277. padding:15px 19px;
  278. border-radius:10px;
  279. }
  280. .listitem-left{
  281. width:98.5px;
  282. height:96.5px;
  283. margin-right:8px;
  284. border-radius:5px;
  285. }
  286. .companyname{
  287. font-size:14px;
  288. color:#333;
  289. }
  290. .introduce{
  291. font-size:12px;
  292. color:#676E80;
  293. }
  294. .companylocation{
  295. color:#676E80;
  296. font-size:12px;
  297. margin-top:8px;
  298. padding:4px 9px;
  299. }
  300. .distance{
  301. color:#AFB3BF;
  302. padding:4px;
  303. margin-top:8px;
  304. }
  305. /* 数据--》 */
  306. .button{
  307. display:inline-block;
  308. border:1px solid #CDCDCD;
  309. padding:6px 15px;
  310. border-radius:15px;
  311. margin:5px 3px;
  312. }
  313. .listitemStatus{
  314. margin-left:2px;
  315. }
  316. .listitemStatus.audit{
  317. color:#FE6430;
  318. }
  319. .listitemStatus.notPass{
  320. color:#FB1E1E;
  321. }
  322. .listitemStatus.pass{
  323. color:#22C572;
  324. }
  325. .exitloginwrap{
  326. position:fixed;
  327. bottom:0;
  328. left:0;
  329. width:100%;
  330. padding-bottom:20px;
  331. }
  332. .exitlogin{
  333. width:90%;
  334. background:#22C572;
  335. border-radius:30px;
  336. color:#fff;
  337. font-size:17px;
  338. }
  339. .exitlogin:after{
  340. border:none;
  341. }
  342. </style>