depotAcquisition.vue 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352
  1. <template>
  2. <view class="">
  3. <view class="header">
  4. <view class='locationwrap' @click='naviageToPage("/pages/user/depotAcquisition/selectCity")'>
  5. {{currentCityName}}
  6. <u-icon name="arrow-down" size="28" class="icon-jt"></u-icon>
  7. </view>
  8. <u-search class="search" bg-color="#F5F6F9" placeholder="请输入仓库名" v-model="searchKeyWord"
  9. :show-action="false" @change="searchChange"></u-search>
  10. <!-- <view @click='naviageToPage("/pages/user/depotAcquisition/grainDeliveryRecord")'
  11. class='Regular flex align-item-center distribution justify-center'>
  12. <image class='cangku' src="../../../static/img/liangmai/cangku.png" mode=""></image>
  13. </view> -->
  14. </view>
  15. <view class="content1" v-for="(item,index) in dataList" :key="index">
  16. <view class="row row1">
  17. <view class="title">{{item.warehouseName}}</view>
  18. <view class='follow' @click="followClick(item)">{{item.follow=='未关注'?'+关注':'已关注'}}</view>
  19. </view>
  20. <view class="row2">
  21. <view class='position'>
  22. <image class='location' src="../../../static/img/liangmai/icon_ditu.png" mode=""></image>
  23. {{item.warehousePrivate}}{{item.warehouseCity}}{{item.warehouseArea}}{{item.detailedAddress}}
  24. </view>
  25. </view>
  26. <view class="row3">
  27. <view class="row3-item">
  28. <u-read-more color='#22C572' show-height="140" :index="index" :shadow-style="shadowStyle"
  29. :toggle="true" close-text="展开阅读更多内容" @open='open' @close='close'>
  30. <rich-text :nodes="item.acquisitionInformation" class="rich-item"></rich-text>
  31. <!-- @load="parseLoaded" -->
  32. <!-- <u-parse :html="item.content" ></u-parse> -->
  33. </u-read-more>
  34. </view>
  35. </view>
  36. <view class="row4">
  37. <view class="time">{{item.updateDate}}</view>
  38. <view class="btn"
  39. @click='naviageToPage("/pages/user/depotAcquisition/grainDeliveryRegistration?warehouseName="+item.warehouseName+"&warehouseId="+item.warehouseId+"&warehousePrivate="+item.warehousePrivate+"&warehouseCity="+item.warehouseCity+"&warehouseArea="+item.warehouseArea+"&detailedAddress="+item.detailedAddress)'>
  40. 我要送粮
  41. </view>
  42. </view>
  43. </view>
  44. <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
  45. :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='提示'
  46. :showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
  47. </view>
  48. </template>
  49. <script>
  50. import {
  51. mapState
  52. } from 'vuex';
  53. export default {
  54. components: {
  55. },
  56. data() {
  57. return {
  58. isShowAlert: false,
  59. content: '当前登入信息验证失败,是否重新登录?',
  60. currentCityName: '',
  61. searchKeyWord: '',
  62. shadowStyle: {
  63. backgroundImage: "none",
  64. paddingTop: "0",
  65. marginTop: "20rpx",
  66. },
  67. dataList: [],
  68. currentPage: 1,
  69. pageSize: 10,
  70. loadStatus: 'loading',
  71. isLoadMore: false,
  72. }
  73. },
  74. onLoad() {
  75. },
  76. // #ifndef MP
  77. onNavigationBarButtonTap(e) {
  78. const index = e.index;
  79. if (index == 1) {
  80. uni.navigateBack()
  81. } else {
  82. this.naviageToPage("/pages/user/depotAcquisition/grainDeliveryRecord")
  83. }
  84. },
  85. // #endif
  86. computed: {
  87. ...mapState(['hasLogin', 'userInfo']),
  88. },
  89. onReachBottom() { //上拉触底函数
  90. if (!this.isLoadMore) { //此处判断,上锁,防止重复请求
  91. this.isLoadMore = true
  92. this.currentPage += 1
  93. this.getListData()
  94. }
  95. },
  96. onPullDownRefresh() {
  97. this.currentPage = 1
  98. this.isLoadMore = false
  99. this.loadStatus = 'loading'
  100. this.dataList = []
  101. this.getListData()
  102. setTimeout(function() {
  103. uni.stopPullDownRefresh();
  104. }, 1000);
  105. },
  106. onShow() {
  107. let _city = uni.getStorageSync("depotAcquisition_selectCity")
  108. this.currentCityName = _city ? _city.positionName.cityName : ''
  109. // this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
  110. // console.log("checkSession", res)
  111. // if (res.data.data == "INVALID") {
  112. // this.isShowAlert = true;
  113. // }
  114. // this.currentPage = 1
  115. // this.isLoadMore = false
  116. // this.loadStatus = 'more'
  117. // this.getListData()
  118. // })
  119. this.currentPage = 1
  120. this.isLoadMore = false
  121. this.loadStatus = 'more'
  122. this.getListData()
  123. console.log("hasLogin", this.hasLogin)
  124. },
  125. methods: {
  126. getListData() {
  127. if (this.currentCityName == '全国') this.currentCityName = ''
  128. this.$api.doRequest('get', '/acquisitionInfo/selectAcquisitionPage', {
  129. searchKeyWord: this.searchKeyWord,
  130. city: this.currentCityName,
  131. compId: uni.getStorageSync('pcUserInfo').compId,
  132. loginPhone:uni.getStorageSync("userInfo").phone,
  133. }).then(res => {
  134. if (res.data.code == "200") {
  135. if (this.currentCityName == '') this.currentCityName = '全国'
  136. this.dataList = res.data.data
  137. this.isLoadMore = true
  138. this.loadStatus = 'nomore'
  139. }
  140. })
  141. },
  142. followClick(val) {
  143. console.log(val)
  144. let _url = ''
  145. if(val.follow=='已关注'){
  146. _url = '/acquisitionInfo/api/followNot'
  147. }else{
  148. _url = '/acquisitionInfo/api/follow'
  149. }
  150. this.$api.doRequest('post', _url, {
  151. id: val.id,
  152. commonId: uni.getStorageSync("userInfo").id,
  153. loginPhone:uni.getStorageSync("userInfo").phone,
  154. warehouseName:val.warehouseName,
  155. }).then(res => {
  156. if (res.data.code == "200") {
  157. if (val.follow == '未关注') {
  158. val.follow = '已关注'
  159. this.$api.msg('关注成功')
  160. } else {
  161. val.follow = '未关注'
  162. this.$api.msg('取消关注成功')
  163. }
  164. this.$forceUpdate()
  165. }
  166. })
  167. // this.$api.doRequest('post', '/acquisitionInfo/api/editFollowFlag', {
  168. // id: val.id,
  169. // commonId: uni.getStorageSync("userInfo").id,
  170. // }).then(res => {
  171. // if (res.data.code == "200") {
  172. // if (res.data.data == '1') {
  173. // val.followFlag = '1'
  174. // this.$api.msg('关注成功')
  175. // } else {
  176. // val.followFlag = '0'
  177. // this.$api.msg('取消关注成功')
  178. // }
  179. // this.$forceUpdate()
  180. // }
  181. // })
  182. },
  183. open(e) {
  184. console.log(e)
  185. },
  186. close(e) {
  187. console.log(e)
  188. },
  189. /**
  190. * 统一跳转接口,拦截未登录路由
  191. * navigator标签现在默认没有转场动画,所以用view
  192. */
  193. naviageToPage(url) {
  194. if (!this.hasLogin) {
  195. url = '/pages/public/login';
  196. }
  197. uni.navigateTo({
  198. url
  199. })
  200. },
  201. alertBtn() {
  202. uni.navigateTo({
  203. url: '/pages/public/login'
  204. })
  205. },
  206. cancelClick() {
  207. this.isShowAlert = false
  208. },
  209. searchChange(e) {
  210. console.log(e)
  211. this.getListData()
  212. }
  213. }
  214. }
  215. </script>
  216. <style lang='scss' scoped>
  217. page {
  218. background: #F5F6FA;
  219. }
  220. .wrap {
  221. background: #fff;
  222. margin: 10px;
  223. border-radius: 10px;
  224. padding: 10px;
  225. /* position: relative; */
  226. top: 20rpx;
  227. }
  228. .header {
  229. padding: 25rpx;
  230. background: #fff;
  231. border-radius: 0 0 10px 10px;
  232. display: flex;
  233. justify-content: space-between;
  234. align-items: center;
  235. position: relative;
  236. /deep/.u-content {
  237. padding-left: 180rpx;
  238. }
  239. }
  240. .location {
  241. width: 32rpx;
  242. height: 32rpx;
  243. margin-right: 10rpx;
  244. }
  245. .locationwrap {
  246. font-size: 16px;
  247. display: flex;
  248. align-items: center;
  249. position: absolute;
  250. top: 0;
  251. bottom: 0;
  252. margin: auto;
  253. /* height: 100%; */
  254. left: 60rpx
  255. }
  256. .cangku {
  257. width: 16.5px;
  258. height: 16.5px;
  259. margin-right: 5px;
  260. }
  261. .search {}
  262. .rich-item {
  263. line-height: 46rpx;
  264. }
  265. .row1 {
  266. display: flex;
  267. justify-content: space-between;
  268. }
  269. .row4 {
  270. display: flex;
  271. align-items: center;
  272. justify-content: space-between;
  273. .btn {
  274. background: #22C572;
  275. border-radius: 40rpx;
  276. font-size: 28rpx;
  277. font-weight: 400;
  278. color: #FFFFFF;
  279. padding: 10rpx 30rpx;
  280. }
  281. .time {
  282. color: #878C9C;
  283. margin: 20rpx 0;
  284. }
  285. }
  286. .icon-jt {
  287. margin-left: 20rpx;
  288. }
  289. .content1 {
  290. background: white;
  291. margin: 20rpx;
  292. padding: 30rpx;
  293. border-radius: 20rpx;
  294. .row1 {
  295. .title {
  296. font-size: 32rpx;
  297. font-weight: 500;
  298. color: #333333;
  299. }
  300. .follow {
  301. border: 1px solid #EEEEEE;
  302. font-weight: 400;
  303. color: #878C9C;
  304. padding: 9rpx 28rpx;
  305. border-radius: 40rpx;
  306. }
  307. }
  308. .row2 {
  309. .position {
  310. margin: 20rpx 0;
  311. font-size: 12px;
  312. color: #676E80;
  313. background: #F5F6FA;
  314. padding: 0rpx 20rpx;
  315. height: 50rpx;
  316. display: flex;
  317. align-items: center;
  318. border-radius: 50rpx;
  319. }
  320. }
  321. }
  322. </style>