record.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495
  1. <template>
  2. <view class="center">
  3. <!-- <view class="bottom flex">
  4. <view class="bottonCss" @click="releaseclick">
  5. <image src="../../static/img/liangmai/fabu-2@3x.png" mode="" style="width: 40rpx; height: 40rpx;">
  6. </image>
  7. <view style="color: #656765;">发布</view>
  8. </view>
  9. <view class="bottonCss" @click="record">
  10. <image src="../../static/img/liangmai/jilu-2-check@3x.png" mode="" style="width: 40rpx; height: 40rpx;">
  11. </image>
  12. <view>记录</view>
  13. </view>
  14. </view> -->
  15. <view class="topCss">
  16. <view class="back-btn cuIcon-back" @click="navBack"></view>
  17. <view class="introduce">
  18. <view class="portrait">
  19. <image :src="portraits" mode="" style="height: 120rpx;border-radius: 14rpx;"></image>
  20. </view>
  21. <view class="name">{{userName}}</view>
  22. <view class="dongtai">
  23. {{count}}
  24. <text style="color: #AFB3BF;">条动态</text>
  25. </view>
  26. <view class="flex">
  27. <view v-for="(item,index) in choices" class="labels">
  28. <view :class="item.changeCss" @click="querys(item)">{{item.name}}</view>
  29. <view style="width: 40rpx;height: 6rpx;background-color: #22C572;margin: 16rpx auto 0;"
  30. v-if="item.check == true"></view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. <view v-for="(item,index) in release">
  36. <view class="modular">
  37. <view class="flex">
  38. <view class="touxiang">
  39. <image v-if='item.avatarUrl' :src="item.avatarUrl" mode="" style="height: 76rpx;border-radius: 8rpx;"></image>
  40. <image v-else src="../../static/img/myimg/YongHu@3x.png" mode="" style="height: 76rpx;border-radius: 8rpx;"></image>
  41. </view>
  42. <view style="margin: 20rpx 0 0 30rpx;width: 72%;">
  43. <view style="color: #333333;font-weight: 600;font-size: 34rpx;">{{item.compName}}</view>
  44. <view style="color: #AFB3BF; margin-top: 4rpx;">{{item.updateDate}}</view>
  45. </view>
  46. <view class="flex" style="width: 16%; justify-content: flex-end;margin-top: 40rpx;">
  47. <view style="color: #FE6430;margin-right: 16rpx;"
  48. v-if="item.status == '审核中' || item.status == '未审核'|| item.status == '待审核'">{{item.status}}
  49. </view>
  50. <view style="color: #22C572;margin-right: 16rpx;" v-if="item.status == '已通过'">{{item.status}}</view>
  51. <view style="color: #FB1E1E;margin-right: 16rpx;" v-if="item.status == '已驳回'">{{item.status}}</view>
  52. </view>
  53. </view>
  54. <view class="title">{{item.title}}</view>
  55. <view class="titleText">
  56. {{item.content}}
  57. </view>
  58. <view class="imgList flex" v-if="item.address != ''">
  59. <view v-for="(items,count) in item.imgList" style="width: 30%;margin-left: 20rpx;">
  60. <image :src="items" style="height: 220rpx;border-radius: 16rpx;"></image>
  61. </view>
  62. </view>
  63. <view class=" addressTitle flex">
  64. <view class="address flex">
  65. <image src='../../static/img/location.png'
  66. style="width: 26rpx;height: 30rpx;top: 8rpx;margin: 0 10rpx;"></image>
  67. {{item.city}}
  68. </view>
  69. <view style="width: 30%;justify-content: flex-end;margin: 30rpx;" class="flex">
  70. <view @click="delRecord(item)">
  71. <image src='../../static/img/jiaoyi/shanchu@3x.png'
  72. style="width: 32rpx;height: 32rpx;margin-right: 20rpx;top: 4rpx;"></image>
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. </view>
  78. <view v-show="isLoadMore">
  79. <!-- <uni-load-more :status="loadStatus"></uni-load-more> -->
  80. <!-- <u-loadmore :status="status" /> -->
  81. <u-loadmore :status="loadStatus" icon icon-type="circle" margin-bottom="80" margin-top="60rpx" />
  82. </view>
  83. <view style='height:12vh;background:#F5F6FA;line-height:12vh;text-align:center;' v-if='release.length == 0'>
  84. 当前暂无结果
  85. </view>
  86. </view>
  87. </template>
  88. <script>
  89. import {
  90. mapState
  91. } from 'vuex';
  92. export default {
  93. data() {
  94. return {
  95. count: 0,
  96. portraits: "",
  97. choices: [{
  98. name: "全部",
  99. check: true,
  100. changeCss: "label2",
  101. },
  102. {
  103. name: "审核中",
  104. check: false,
  105. changeCss: "label",
  106. },
  107. {
  108. name: "已通过",
  109. check: false,
  110. changeCss: "label",
  111. },
  112. {
  113. name: "未通过",
  114. check: false,
  115. changeCss: "label",
  116. },
  117. {
  118. name: "已过期",
  119. check: false,
  120. changeCss: "label",
  121. }
  122. ],
  123. release: [],
  124. releaseInfo: [],
  125. currentPage: 1,
  126. pageSize: 10,
  127. imgList: [],
  128. userName: "",
  129. searchType: "",
  130. searchTypeInfo: "",
  131. isLoadMore: false,
  132. loadStatus: "loading",
  133. }
  134. },
  135. computed: {
  136. ...mapState(['hasLogin', 'userInfo'])
  137. },
  138. onShow() {
  139. console.log(this.userInfo.avatarUrl)
  140. this.userName = this.userInfo.userName
  141. this.portraits = this.userInfo.avatarUrl?this.userInfo.avatarUrl:'../../static/img/myimg/YongHu@3x.png'
  142. this.getData()
  143. },
  144. //下拉刷新
  145. onPullDownRefresh() {
  146. this.getData()
  147. setTimeout(function() {
  148. uni.stopPullDownRefresh();
  149. }, 1000);
  150. this.release = []
  151. },
  152. onReachBottom() { //上拉触底函数
  153. var that = this
  154. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  155. this.isLoadMore = true
  156. this.currentPage += 1
  157. setTimeout(function() {
  158. uni.stopPullDownRefresh();
  159. that.getRelease()
  160. }, 1000);
  161. // this.getRelease()
  162. }
  163. },
  164. methods: {
  165. navBack() {
  166. uni.navigateBack()
  167. },
  168. releaseclick() {
  169. this.$api.doRequest('get', '/settledCompanyInfo/companyList', {loginPhone:this.userInfo.phone})
  170. .then(res => {
  171. if (res.data.code == 200) {
  172. if(res.data.data.length > 0){
  173. uni.navigateTo({
  174. url: `/pages/grain_pulse/release`
  175. })
  176. }else{
  177. uni.showModal({
  178. content: "您还没有入驻粮脉,不能发布,是否前去完善入驻信息!",
  179. showCancel: true,
  180. confirmText: '前往',
  181. success: function(res) {
  182. if (res.confirm) {
  183. uni.navigateTo({
  184. url: `/pages/grain_pulse/enter`
  185. })
  186. }
  187. }
  188. })
  189. }
  190. }
  191. })
  192. },
  193. record() {
  194. uni.navigateTo({
  195. url: `/pages/grain_pulse/record`
  196. })
  197. },
  198. querys(item) {
  199. for (var i = 0; i < this.choices.length; i++) {
  200. if (this.choices[i].name == item.name) {
  201. this.choices[i].check = true
  202. this.choices[i].changeCss = "label2"
  203. } else {
  204. this.choices[i].check = false
  205. this.choices[i].changeCss = "label"
  206. }
  207. }
  208. if (item.name == "审核中") {
  209. this.searchType = "1"
  210. } else if (item.name == "已通过") {
  211. this.searchType = "2"
  212. } else if (item.name == "未通过") {
  213. this.searchType = "3"
  214. }else if (item.name == "已过期") {
  215. this.searchType = "4"
  216. } else {
  217. this.searchType = ""
  218. }
  219. this.getData()
  220. },
  221. getData() {
  222. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  223. currentPage: 1,
  224. pageSize: 10,
  225. phone: this.userInfo.phone,
  226. searchType: this.searchType
  227. })
  228. .then(res => {
  229. console.log("res",res)
  230. if (res.data.code == 200) {
  231. this.release = res.data.data.records
  232. if (this.release.length > 0) {
  233. this.count = this.release.length
  234. this.isLoadMore = false
  235. for (let i = 0; i < this.release.length; i++) {
  236. this.release[i].imgList = this.release[i].address.split(",")
  237. }
  238. }
  239. }
  240. })
  241. },
  242. getRelease() {
  243. if (!this.searchType) {
  244. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  245. currentPage: this.currentPage,
  246. pageSize: this.pageSize,
  247. phone: this.userInfo.phone,
  248. searchType: this.searchType
  249. })
  250. .then(res => {
  251. if (res.data.code == 200) {
  252. this.releaseInfo = res.data.data.records
  253. if (this.releaseInfo.length > 0) {
  254. this.release = this.release.concat(this.releaseInfo)
  255. this.count = this.release.length
  256. this.isLoadMore = false
  257. for (let i = 0; i < this.release.length; i++) {
  258. this.release[i].imgList = this.release[i].address.split(",")
  259. }
  260. } else {
  261. this.loadStatus = 'nomore'
  262. }
  263. }
  264. })
  265. this.searchTypeInfo = this.searchType
  266. } else {
  267. if (this.searchTypeInfo == this.searchType) {
  268. // this.loadStatus = "loading"
  269. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  270. currentPage: this.currentPage,
  271. pageSize: this.pageSize,
  272. loginPhone: this.userInfo.phone,
  273. searchType: this.searchType
  274. })
  275. .then(res => {
  276. if (res.data.code == 200) {
  277. this.releaseInfo = res.data.data.records
  278. if (this.releaseInfo.length > 0) {
  279. this.release = this.release.concat(this.releaseInfo)
  280. this.count = this.release.length
  281. this.isLoadMore = false
  282. for (let i = 0; i < this.release.length; i++) {
  283. this.release[i].imgList = this.release[i].address.split(",")
  284. }
  285. } else {
  286. this.loadStatus = 'nomore'
  287. }
  288. }
  289. })
  290. } else {
  291. this.$api.doRequest('get', '/settledCompanyDynamics/selectSettledCompanyDynamicsPage', {
  292. currentPage: this.currentPage,
  293. pageSize: this.pageSize,
  294. loginPhone: this.userInfo.phone,
  295. searchType: this.searchType
  296. })
  297. .then(res => {
  298. if (res.data.code == 200) {
  299. this.releaseInfo = res.data.data.records
  300. if (this.releaseInfo.length > 0) {
  301. this.release = this.release.concat(this.releaseInfo)
  302. this.count = this.release.length
  303. this.isLoadMore = false
  304. for (let i = 0; i < this.release.length; i++) {
  305. this.release[i].imgList = this.release[i].address.split(",")
  306. }
  307. } else {
  308. this.loadStatus = 'nomore'
  309. }
  310. }
  311. })
  312. }
  313. this.searchTypeInfo = this.searchType
  314. }
  315. },
  316. delRecord(item) {
  317. var that = this
  318. uni.showModal({
  319. content: "确定删除该动态?",
  320. showCancel: true,
  321. confirmText: '确定',
  322. success: function(res) {
  323. if (res.confirm) {
  324. that.$api.doRequest('post',
  325. '/settledCompanyDynamics/api/deleteSettledCompanyInfo', {
  326. id: item.id,
  327. phone: item.phone
  328. })
  329. .then(res => {
  330. if (res.data.code == 200) {
  331. uni.showToast({
  332. title: '删除成功!',
  333. icon: 'none',
  334. duration: 2000,
  335. success() {
  336. setTimeout(function() {
  337. that.getData()
  338. }, 1000);
  339. }
  340. })
  341. }
  342. })
  343. }
  344. }
  345. })
  346. }
  347. }
  348. }
  349. </script>
  350. <style lang="scss" scoped>
  351. .center {
  352. overflow: scroll;
  353. margin-bottom: 100rpx;
  354. }
  355. .topCss {
  356. overflow: scroll;
  357. background: url(../../static/img/liangmai/record@3x.png);
  358. background-size: 100%;
  359. background-repeat: no-repeat;
  360. }
  361. .back-btn {
  362. position: absolute;
  363. left: 40upx;
  364. z-index: 9999;
  365. padding-top: var(--status-bar-height);
  366. top: 40upx;
  367. font-size: 40upx;
  368. color: #fff;
  369. }
  370. .modular {
  371. width: 94%;
  372. margin: 40rpx auto;
  373. background-color: #FFFFFF;
  374. border-radius: 40rpx;
  375. // margin-top: 40rpx;
  376. }
  377. .modular {
  378. width: 94%;
  379. margin: 20rpx auto;
  380. background-color: #FFFFFF;
  381. border-radius: 40rpx;
  382. margin-top: 40rpx;
  383. }
  384. .introduce {
  385. // height: 300rpx;
  386. background-color: #FFFFFF;
  387. border-top-right-radius: 40rpx;
  388. border-top-left-radius: 40rpx;
  389. margin-top: 250rpx;
  390. }
  391. .portrait {
  392. width: 120rpx;
  393. height: 120rpx;
  394. margin: 0 auto 0;
  395. position: relative;
  396. top: -70rpx;
  397. }
  398. .name {
  399. text-align: center;
  400. color: #333333;
  401. font-size: 40rpx;
  402. margin-top: -30rpx;
  403. }
  404. .dongtai {
  405. text-align: center;
  406. }
  407. .labels {
  408. width: 140rpx;
  409. text-align: center;
  410. margin-top: 60rpx;
  411. }
  412. .label {
  413. color: #333333;
  414. font-size: 32rpx;
  415. }
  416. .label2 {
  417. color: #333333;
  418. font-size: 36rpx;
  419. font-weight: 600;
  420. }
  421. .touxiang {
  422. width: 76rpx;
  423. height: 76rpx;
  424. margin: 20rpx 0 0 34rpx;
  425. }
  426. .title {
  427. font-size: 38rpx;
  428. font-weight: 600;
  429. margin-left: 30rpx;
  430. }
  431. .titleText {
  432. font-size: 30rpx;
  433. margin-left: 30rpx;
  434. margin-top: 10rpx;
  435. }
  436. .imgList {
  437. width: 100%;
  438. margin-top: 30rpx;
  439. flex-wrap: wrap;
  440. }
  441. .address {
  442. width: 60%;
  443. height: 48rpx;
  444. background-color: #F5F6FA;
  445. border-radius: 24rpx;
  446. margin-left: 30rpx;
  447. line-height: 48rpx;
  448. margin: 30rpx;
  449. }
  450. .addressTitle{
  451. height: 90rpx;
  452. background-color: #F5F6FA;
  453. border-radius: 24rpx;
  454. }
  455. .bottom {
  456. width: 100%;
  457. height: 160rpx;
  458. background-color: #FFFFFF;
  459. position: fixed;
  460. bottom: 0rpx;
  461. z-index: 9999;
  462. }
  463. .bottonCss {
  464. width: 50%;
  465. height: 40rpx;
  466. margin-top: 40rpx;
  467. text-align: center;
  468. font-size:20rpx;
  469. }
  470. </style>