depotAcquisition.vue 9.5 KB

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