depotAcquisition.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348
  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. 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. loginPhone:uni.getStorageSync("userInfo").phone,
  129. }).then(res => {
  130. if (res.data.code == "200") {
  131. if (this.currentCityName == '') this.currentCityName = '全国'
  132. this.dataList = res.data.data
  133. this.isLoadMore = true
  134. this.loadStatus = 'nomore'
  135. }
  136. })
  137. },
  138. followClick(val) {
  139. console.log(val)
  140. let _url = ''
  141. if(val.follow=='已关注'){
  142. _url = '/acquisitionInfo/api/followNot'
  143. }else{
  144. _url = '/acquisitionInfo/api/follow'
  145. }
  146. this.$api.doRequest('post', _url, {
  147. id: val.id,
  148. commonId: uni.getStorageSync("userInfo").id,
  149. loginPhone:uni.getStorageSync("userInfo").phone,
  150. warehouseName:val.warehouseName,
  151. }).then(res => {
  152. if (res.data.code == "200") {
  153. if (val.follow == '未关注') {
  154. val.follow = '已关注'
  155. this.$api.msg('关注成功')
  156. } else {
  157. val.follow = '未关注'
  158. this.$api.msg('取消关注成功')
  159. }
  160. this.$forceUpdate()
  161. }
  162. })
  163. // this.$api.doRequest('post', '/acquisitionInfo/api/editFollowFlag', {
  164. // id: val.id,
  165. // commonId: uni.getStorageSync("userInfo").id,
  166. // }).then(res => {
  167. // if (res.data.code == "200") {
  168. // if (res.data.data == '1') {
  169. // val.followFlag = '1'
  170. // this.$api.msg('关注成功')
  171. // } else {
  172. // val.followFlag = '0'
  173. // this.$api.msg('取消关注成功')
  174. // }
  175. // this.$forceUpdate()
  176. // }
  177. // })
  178. },
  179. open(e) {
  180. console.log(e)
  181. },
  182. close(e) {
  183. console.log(e)
  184. },
  185. /**
  186. * 统一跳转接口,拦截未登录路由
  187. * navigator标签现在默认没有转场动画,所以用view
  188. */
  189. naviageToPage(url) {
  190. if (!this.hasLogin) {
  191. url = '/pages/public/login';
  192. }
  193. uni.navigateTo({
  194. url
  195. })
  196. },
  197. alertBtn() {
  198. uni.navigateTo({
  199. url: '/pages/public/login'
  200. })
  201. },
  202. cancelClick() {
  203. this.isShowAlert = false
  204. },
  205. searchChange(e) {
  206. console.log(e)
  207. this.getListData()
  208. }
  209. }
  210. }
  211. </script>
  212. <style lang='scss' scoped>
  213. page {
  214. background: #F5F6FA;
  215. }
  216. .wrap {
  217. background: #fff;
  218. margin: 10px;
  219. border-radius: 10px;
  220. padding: 10px;
  221. /* position: relative; */
  222. top: 20rpx;
  223. }
  224. .header {
  225. padding: 25rpx;
  226. background: #fff;
  227. border-radius: 0 0 10px 10px;
  228. display: flex;
  229. justify-content: space-between;
  230. align-items: center;
  231. position: relative;
  232. /deep/.u-content {
  233. padding-left: 180rpx;
  234. }
  235. }
  236. .location {
  237. width: 32rpx;
  238. height: 32rpx;
  239. margin-right: 10rpx;
  240. }
  241. .locationwrap {
  242. font-size: 16px;
  243. display: flex;
  244. align-items: center;
  245. position: absolute;
  246. top: 0;
  247. bottom: 0;
  248. margin: auto;
  249. /* height: 100%; */
  250. left: 60rpx
  251. }
  252. .cangku {
  253. width: 16.5px;
  254. height: 16.5px;
  255. margin-right: 5px;
  256. }
  257. .search {}
  258. .rich-item {
  259. line-height: 46rpx;
  260. }
  261. .row1 {
  262. display: flex;
  263. justify-content: space-between;
  264. }
  265. .row4 {
  266. display: flex;
  267. align-items: center;
  268. justify-content: space-between;
  269. .btn {
  270. background: #22C572;
  271. border-radius: 40rpx;
  272. font-size: 28rpx;
  273. font-weight: 400;
  274. color: #FFFFFF;
  275. padding: 10rpx 30rpx;
  276. }
  277. .time {
  278. color: #878C9C;
  279. margin: 20rpx 0;
  280. }
  281. }
  282. .icon-jt {
  283. margin-left: 20rpx;
  284. }
  285. .content1 {
  286. background: white;
  287. margin: 20rpx;
  288. padding: 30rpx;
  289. border-radius: 20rpx;
  290. .row1 {
  291. .title {
  292. font-size: 32rpx;
  293. font-weight: 500;
  294. color: #333333;
  295. }
  296. .follow {
  297. border: 1px solid #EEEEEE;
  298. font-weight: 400;
  299. color: #878C9C;
  300. padding: 9rpx 28rpx;
  301. border-radius: 40rpx;
  302. }
  303. }
  304. .row2 {
  305. .position {
  306. margin: 20rpx 0;
  307. font-size: 12px;
  308. color: #676E80;
  309. background: #F5F6FA;
  310. padding: 0rpx 20rpx;
  311. height: 50rpx;
  312. display: flex;
  313. align-items: center;
  314. border-radius: 50rpx;
  315. }
  316. }
  317. }
  318. </style>