depotAcquisition.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292
  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.followFlag=='0'?'+关注':'已关注'}}</view>
  19. </view>
  20. <view class="row2">
  21. <view class="time">{{item.createDate}}</view>
  22. </view>
  23. <view class="row3">
  24. <view class="row3-item">
  25. <u-read-more color='#22C572' show-height="140" :index="index" :shadow-style="shadowStyle"
  26. :toggle="true" close-text="展开阅读更多内容" @open='open' @close='close'>
  27. <rich-text :nodes="item.acquisitionInformation" class="rich-item"></rich-text>
  28. <!-- @load="parseLoaded" -->
  29. <!-- <u-parse :html="item.content" ></u-parse> -->
  30. </u-read-more>
  31. </view>
  32. </view>
  33. <view class="row4">
  34. <view class='' @click='naviageToPage("/pages/grain_pulse/position/position")'>
  35. <!-- <image class='location' src="../../../static/img/liangmai/icon_ditu@2x.png" mode=""></image> -->
  36. {{item.warehousePrivate}}{{item.warehouseCity}}{{item.warehouseArea}}{{item.detailedAddress}}
  37. </view>
  38. <u-button
  39. @click='naviageToPage("/pages/user/depotAcquisition/grainDeliveryRegistration?itemValue="+JSON.stringify(item))'>
  40. 我要送粮
  41. </u-button>
  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) {debugger
  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. console.log("hasLogin", this.hasLogin)
  120. },
  121. methods: {
  122. getListData() {
  123. if (this.currentCityName == '全国') this.currentCityName = ''
  124. this.$api.doRequest('get', '/acquisitionInfo/selectAcquisitionPage', {
  125. searchKeyWord: this.searchKeyWord,
  126. city: this.currentCityName,
  127. compId: uni.getStorageSync('pcUserInfo').compId,
  128. pageSize: this.pageSize,
  129. currentPage: this.currentPage
  130. }).then(res => {
  131. if (res.data.code == "200") {
  132. if (this.currentCityName == '') this.currentCityName = '全国'
  133. this.dataList = res.data.data.records
  134. this.isLoadMore = true
  135. this.loadStatus = 'nomore'
  136. }
  137. })
  138. },
  139. followClick(val) {
  140. this.$api.doRequest('post', '/acquisitionInfo/api/editFollowFlag', {
  141. id: val.id
  142. }).then(res => {
  143. if (res.data.code == "200") {
  144. if (res.data.data == '1') {
  145. val.followFlag = '1'
  146. this.$api.msg('关注成功')
  147. } else {
  148. val.followFlag = '0'
  149. this.$api.msg('取消关注成功')
  150. }
  151. this.$forceUpdate()
  152. }
  153. })
  154. },
  155. open(e) {
  156. console.log(e)
  157. },
  158. close(e) {
  159. console.log(e)
  160. },
  161. /**
  162. * 统一跳转接口,拦截未登录路由
  163. * navigator标签现在默认没有转场动画,所以用view
  164. */
  165. naviageToPage(url) {
  166. if (!this.hasLogin) {
  167. url = '/pages/public/login';
  168. }
  169. uni.navigateTo({
  170. url
  171. })
  172. },
  173. alertBtn() {
  174. uni.navigateTo({
  175. url: '/pages/public/login'
  176. })
  177. },
  178. cancelClick() {
  179. this.isShowAlert = false
  180. },
  181. searchChange(e) {
  182. console.log(e)
  183. }
  184. }
  185. }
  186. </script>
  187. <style lang='scss' scoped>
  188. page {
  189. background: #F5F6FA;
  190. }
  191. .wrap {
  192. background: #fff;
  193. margin: 10px;
  194. border-radius: 10px;
  195. padding: 10px;
  196. /* position: relative; */
  197. top: 20rpx;
  198. }
  199. .header {
  200. padding: 25rpx;
  201. background: #fff;
  202. border-radius: 0 0 10px 10px;
  203. display: flex;
  204. justify-content: space-between;
  205. align-items: center;
  206. position: relative;
  207. /deep/.u-content {
  208. padding-left: 180rpx;
  209. }
  210. }
  211. .location {
  212. width: 32rpx;
  213. height: 32rpx;
  214. margin-right: 10rpx;
  215. }
  216. .locationwrap {
  217. font-size: 16px;
  218. display: flex;
  219. align-items: center;
  220. position: absolute;
  221. top: 0;
  222. bottom: 0;
  223. margin: auto;
  224. /* height: 100%; */
  225. left: 60rpx
  226. }
  227. .cangku {
  228. width: 16.5px;
  229. height: 16.5px;
  230. margin-right: 5px;
  231. }
  232. .search {}
  233. .rich-item {
  234. line-height: 46rpx;
  235. }
  236. .row1 {
  237. display: flex;
  238. justify-content: space-between;
  239. }
  240. .row4 {
  241. display: flex;
  242. }
  243. .icon-jt{
  244. margin-left: 20rpx;
  245. }
  246. .content1{
  247. background: white;
  248. margin: 20rpx;
  249. padding: 30rpx;
  250. border-radius: 20rpx;
  251. .row1{
  252. .title{
  253. font-size: 32rpx;
  254. font-weight: 500;
  255. color: #333333;
  256. }
  257. .follow{
  258. border: 1px solid #EEEEEE;
  259. font-weight: 400;
  260. color: #878C9C;
  261. padding: 9rpx 28rpx;
  262. border-radius: 40rpx;
  263. }
  264. }
  265. .row2{
  266. .time{
  267. color: #878C9C;
  268. margin: 20rpx 0;
  269. }
  270. }
  271. }
  272. </style>