record.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437
  1. <template>
  2. <view>
  3. <mescroll-body ref="mescrollRef" @init="mescrollInit" top="20" @down="downCallback" :up="upOption"
  4. @up="upCallback" @emptyclick="emptyClick">
  5. <!-- 数据列表 -->
  6. <view class="list" v-if="goods.length!=0">
  7. <view class="list-item" v-for="(item,index) in goods">
  8. <view class="row1 flex jcsb alc">
  9. <view class="left flex alc">
  10. <view class="bottom" style="margin-top: 6rpx;">
  11. <text class="color1" v-if="item.tranType=='采购'">采购</text>
  12. <text class="color2" v-if="item.tranType=='销售'">销售</text>
  13. <text class="color3">{{item.updateDate}}</text>
  14. </view>
  15. </view>
  16. <view class="right" style="color: #FE6430;" v-if="item.status=='待审核'">审核中</view>
  17. <view class="right" style="color: #FB2323;" v-if="item.status=='已驳回'">已驳回</view>
  18. <view class="right" style="color: #22C572;" v-if="item.status=='审核通过'">已通过</view>
  19. </view>
  20. <view class="row2">
  21. <mote-lines-divide :dt="item.publishingContent" :line="3" expandText="展开" foldHint="收起" />
  22. </view>
  23. <view class="row3">
  24. <image :src="item1" mode="aspectFill" v-for="(item1,index) in item.imgList" class="img">
  25. </image>
  26. </view>
  27. <view class="row4">
  28. <u-icon name="map-fill" color="#AFB3BF" size="28" bold></u-icon>
  29. <text class="text">{{item.placeDelivery}}</text>
  30. </view>
  31. <view class="row5">
  32. <view class="del btn" @click="del(item)">
  33. 删除
  34. </view>
  35. <view class="edit btn" @click="edit(item)">
  36. 编辑
  37. </view>
  38. <view class="edit btn" @click="refresh(item)">
  39. 刷新
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </mescroll-body>
  45. <view class="add" @click="release">
  46. <u-icon name="plus" color="#fff" size="34" bold></u-icon>
  47. </view>
  48. <u-toast ref="uToast" />
  49. </view>
  50. </template>
  51. <script>
  52. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  53. import MoteLinesDivide from "@/components/text-over-flow"
  54. import selectAddress from "@/components/selectAddress.vue"
  55. import {
  56. apiGoods
  57. } from "@/api/mock.js"
  58. export default {
  59. components: {
  60. MoteLinesDivide,
  61. selectAddress
  62. },
  63. mixins: [MescrollMixin], // 使用mixin
  64. data() {
  65. return {
  66. canReset: false,
  67. keyword: '',
  68. inputStyle: {
  69. // "padding-left": '30rpx'
  70. },
  71. content: '上半年,普陀区开展“绿剑”系列执法行动二次,共计出动执法人员120余人次,检有关经营主体87余家次,发放宣传资料等200余份;加强农产品和农业…上半年,普陀区开展“绿剑”系列执法行动二次,共计出动执法人员120余人次,检有关经营主体87余家次,发放宣传资料等200余份;加强农产品和农业…',
  72. upOption: {
  73. // page: {
  74. // num: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
  75. // size: 10 // 每页数据的数量
  76. // },
  77. noMoreSize: 4, //如果列表已无数据,可设置列表的总数量要大于半页才显示无更多数据;避免列表数据过少(比如只有一条数据),显示无更多数据会不好看; 默认5
  78. empty: {
  79. icon: '/static/empty.png',
  80. tip: '暂无内容', // 提示
  81. // btnText: '去看看'
  82. }
  83. },
  84. goods: [], //列表数据
  85. tabs: [{
  86. name: '全部',
  87. type: 'xx'
  88. }, {
  89. name: '采购',
  90. type: 'xx'
  91. }, {
  92. name: '销售',
  93. type: 'xx'
  94. }, {
  95. name: '关注',
  96. type: 'xx'
  97. }],
  98. tabIndex: 0 // tab下标
  99. }
  100. },
  101. onShow() {
  102. uni.showTabBar()
  103. uni.hideKeyboard()
  104. var userInfo = uni.getStorageSync("userInfo")
  105. var that = this
  106. console.log("userInfo", userInfo)
  107. this.$nextTick(function() {
  108. this.canReset && this.mescroll.resetUpScroll() // 重置列表数据为第一页
  109. this.canReset && this.mescroll.scrollTo(0, 0) // 重置列表数据为第一页时,建议把滚动条也重置到顶部,避免无法再次翻页的问题
  110. this.canReset = true // 过滤第一次的onShow事件,避免初始化界面时重复触发upCallback, 无需配置auto:false
  111. });
  112. },
  113. onLoad(options) {},
  114. methods: {
  115. refresh(val) {
  116. let _obj = {
  117. id: val.id,
  118. flag: 0
  119. }
  120. uni.showLoading({
  121. title: '数据加载中',
  122. mask: true
  123. })
  124. this.$api.doRequest('post', '/transactionExchangeInfo/editInfo', _obj).then(res => {
  125. console.log(res.data)
  126. if (res.data.code == 200) {
  127. this.$refs.uToast.show({
  128. title: '刷新成功成功',
  129. type: 'success',
  130. })
  131. this.mescroll.resetUpScroll()
  132. }
  133. uni.hideLoading()
  134. })
  135. },
  136. edit(val) {
  137. uni.navigateTo({
  138. url: '/pages/business/editRelease?id=' + val.id
  139. })
  140. },
  141. del(val) {
  142. let _obj = {
  143. id: val.id,
  144. }
  145. uni.showLoading({
  146. title: '数据加载中',
  147. mask: true
  148. })
  149. this.$api.doRequest('post', '/transactionExchangeInfo/deleteInfo', _obj).then(res => {
  150. console.log(res.data)
  151. if (res.data.code == 200) {
  152. this.$refs.uToast.show({
  153. title: '删除成功',
  154. type: 'success',
  155. })
  156. this.mescroll.resetUpScroll()
  157. }
  158. uni.hideLoading()
  159. })
  160. },
  161. selectAddress(val) {
  162. console.log(val)
  163. },
  164. release() {
  165. uni.navigateTo({
  166. url: 'release'
  167. })
  168. },
  169. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  170. upCallback(page) {
  171. //联网加载数据
  172. let _obj = {
  173. pageSize: page.size,
  174. currentPage: page.num,
  175. userId: this.userInfo.id,
  176. }
  177. this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(res => {
  178. console.log(res.data)
  179. if (res.data.code == 200) {
  180. let curPageData = res.data.data.records;
  181. let curPageLen = curPageData.length;
  182. let totalPage = res.data.data.total;
  183. if (page.num == 1) this.goods = [];
  184. this.goods = this.goods.concat(curPageData);
  185. console.log(curPageLen, totalPage)
  186. this.mescroll.endByPage(curPageLen, totalPage);
  187. for (let i = 0; i < this.goods.length; i++) {
  188. this.goods[i].imgList = this.goods[i].urlImg.split(',')
  189. }
  190. }
  191. uni.hideLoading()
  192. })
  193. },
  194. //点击空布局按钮的回调
  195. emptyClick() {
  196. uni.showToast({
  197. title: '点击了按钮,具体逻辑自行实现'
  198. })
  199. },
  200. // 切换菜单
  201. tabChange() {
  202. this.goods = [] // 先置空列表,显示加载进度
  203. this.mescroll.resetUpScroll() // 再刷新列表数据
  204. }
  205. }
  206. }
  207. </script>
  208. <style lang='scss'>
  209. page,
  210. .content {
  211. background: #F5F6FA;
  212. }
  213. .flex {
  214. display: flex;
  215. }
  216. .alc {
  217. align-items: center;
  218. }
  219. .jcse {
  220. justify-content: space-evenly;
  221. }
  222. .jcsb {
  223. justify-content: space-between;
  224. }
  225. .top-warp {
  226. z-index: 998;
  227. position: fixed;
  228. top: --window-top;
  229. /* css变量 */
  230. left: 0;
  231. width: 100%;
  232. /* height: 120upx; */
  233. background-color: white;
  234. }
  235. .top-warp .tip {
  236. font-size: 28upx;
  237. height: 60upx;
  238. line-height: 60upx;
  239. text-align: center;
  240. }
  241. .slot-wrap {
  242. margin-right: 45rpx;
  243. font-size: 32rpx;
  244. }
  245. .list {
  246. margin: 0 20rpx;
  247. .list-item {
  248. padding: 20rpx;
  249. background: #fff;
  250. margin-bottom: 20rpx;
  251. border-radius: 20rpx;
  252. .row1 {
  253. .head-img {
  254. width: 72rpx;
  255. background-color: red;
  256. border-radius: 8rpx;
  257. margin-right: 22rpx;
  258. }
  259. .left {
  260. .title {
  261. font-weight: 700;
  262. color: #333333;
  263. }
  264. .bottom {
  265. .color1 {
  266. font-size: 24rpx;
  267. padding: 4rpx 10rpx;
  268. color: #fff;
  269. display: inline-block;
  270. background: linear-gradient(180deg, #607AE0 0%, #516CDC 100%);
  271. border-radius: 4rpx;
  272. }
  273. .color2 {
  274. font-size: 24rpx;
  275. padding: 4rpx 10rpx;
  276. color: #fff;
  277. display: inline-block;
  278. background: linear-gradient(180deg, #FD714F 0%, #FD613C 100%);
  279. border-radius: 4rpx;
  280. }
  281. .color3 {
  282. font-size: 28rpx;
  283. /* color: #AFB3BF; */
  284. margin-left: 14rpx;
  285. }
  286. }
  287. }
  288. .right {
  289. /* padding: 10rpx 20rpx; */
  290. }
  291. }
  292. .row2 {
  293. margin-top: 20rpx;
  294. /* overflow: hidden;
  295. text-overflow: ellipsis;
  296. width: 100%;
  297. display: -webkit-box;
  298. -webkit-box-orient: vertical;
  299. -webkit-line-clamp: 3;
  300. word-break: break-all; */
  301. }
  302. .row3 {
  303. /* padding: 30rpx 30rpx 0 30rpx; */
  304. margin-top: 18rpx;
  305. display: flex;
  306. align-items: center;
  307. /* justify-content: space-between; */
  308. flex-wrap: wrap;
  309. /* background: #bbb; */
  310. .img {
  311. display: flex;
  312. align-items: center;
  313. justify-content: center;
  314. width: 214rpx;
  315. height: 214rpx;
  316. margin-bottom: 20rpx;
  317. background: lightblue;
  318. list-style: none;
  319. border-radius: 10rpx;
  320. margin-right: 16rpx;
  321. }
  322. .img:nth-of-type(3),
  323. .img:nth-of-type(6),
  324. .img:nth-of-type(9) {
  325. margin-right: 0;
  326. }
  327. }
  328. .row4 {
  329. margin-top: 4rpx;
  330. .text {
  331. color: #878C9C;
  332. font-size: 24rpx;
  333. }
  334. }
  335. }
  336. .case {
  337. font-weight: 700;
  338. margin-left: 6rpx;
  339. }
  340. }
  341. .add {
  342. position: fixed;
  343. bottom: 250rpx;
  344. right: 32rpx;
  345. background: #22C572;
  346. z-index: 999;
  347. width: 84rpx;
  348. height: 84rpx;
  349. border-radius: 50%;
  350. display: flex;
  351. align-items: center;
  352. justify-content: center;
  353. }
  354. .search {
  355. display: flex;
  356. align-items: center;
  357. position: relative;
  358. margin: 20rpx 28rpx 20rpx 28rpx;
  359. .text {
  360. width: 90rpx;
  361. overflow: hidden;
  362. white-space: nowrap;
  363. text-overflow: ellipsis;
  364. }
  365. }
  366. /deep/.u-content {
  367. padding-left: 170rpx;
  368. }
  369. .place {
  370. display: flex;
  371. align-items: center;
  372. left: 28rpx;
  373. position: absolute;
  374. font-weight: 700;
  375. }
  376. .row5 {
  377. display: flex;
  378. justify-content: flex-end;
  379. margin-top: 20rpx;
  380. .btn {
  381. width: 120rpx;
  382. height: 66rpx;
  383. background: #FFFFFF;
  384. border-radius: 33px;
  385. border: 1px solid #CDCDCD;
  386. font-size: 28rpx;
  387. font-weight: 400;
  388. color: #333333;
  389. line-height: 66rpx;
  390. text-align: center;
  391. margin-left: 24rpx;
  392. }
  393. }
  394. </style>