record.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456
  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.remark3}}</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. remark3: new Date().getTime()
  120. }
  121. uni.showLoading({
  122. title: '数据加载中',
  123. mask: true
  124. })
  125. this.$api.doRequest('post', '/transactionExchangeInfo/editInfo', _obj).then(res => {
  126. console.log(res.data)
  127. if (res.data.code == 200) {
  128. this.$refs.uToast.show({
  129. title: '刷新成功成功',
  130. type: 'success',
  131. })
  132. this.mescroll.resetUpScroll()
  133. }
  134. uni.hideLoading()
  135. })
  136. },
  137. edit(val) {
  138. uni.navigateTo({
  139. url: '/pages/business/editRelease?id=' + val.id
  140. })
  141. },
  142. del(val) {
  143. let _obj = {
  144. id: val.id,
  145. }
  146. uni.showLoading({
  147. title: '数据加载中',
  148. mask: true
  149. })
  150. this.$api.doRequest('post', '/transactionExchangeInfo/deleteInfo', _obj).then(res => {
  151. console.log(res.data)
  152. if (res.data.code == 200) {
  153. this.$refs.uToast.show({
  154. title: '删除成功',
  155. type: 'success',
  156. })
  157. this.mescroll.resetUpScroll()
  158. }
  159. uni.hideLoading()
  160. })
  161. },
  162. selectAddress(val) {
  163. console.log(val)
  164. },
  165. release() {
  166. uni.navigateTo({
  167. url: 'release'
  168. })
  169. },
  170. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  171. async upCallback(page) {
  172. //联网加载数据
  173. let _obj = {
  174. pageSize: page.size,
  175. currentPage: page.num,
  176. userId: this.userInfo.id,
  177. }
  178. await this.$api.doRequest('get', '/transactionExchangeInfo/selectTransactionExchangeInfo', _obj).then(res => {
  179. console.log(res.data)
  180. if (res.data.code == 200) {
  181. let curPageData = res.data.data.records;
  182. let curPageLen = curPageData.length;
  183. let totalPage = res.data.data.total;
  184. if (page.num == 1) this.goods = [];
  185. this.goods = this.goods.concat(curPageData);
  186. console.log(curPageLen, totalPage)
  187. this.mescroll.endByPage(curPageLen, totalPage);
  188. // for (let i = 0; i < this.goods.length; i++) {
  189. // this.goods[i].imgList = this.goods[i].urlImg.split(',')
  190. // }
  191. }
  192. uni.hideLoading()
  193. })
  194. if (this.goods.length > 0) {
  195. for (let i = 0; i < this.goods.length; i++) {
  196. await this.$api.doRequest('get', 'appendix/query/getFileList', {
  197. appendixIds: this.goods[i].urlImg
  198. }).then(res1 => {
  199. if (i == this.goods.length - 1) {
  200. uni.hideLoading()
  201. }
  202. var arr = []
  203. for (let q = 0; q < res1.data.data.length; q++) {
  204. arr.push(res1.data.data[q].appendixPath)
  205. }
  206. this.goods[i].imgList = arr
  207. this.$forceUpdate()
  208. })
  209. }
  210. }
  211. },
  212. //点击空布局按钮的回调
  213. emptyClick() {
  214. uni.showToast({
  215. title: '点击了按钮,具体逻辑自行实现'
  216. })
  217. },
  218. // 切换菜单
  219. tabChange() {
  220. this.goods = [] // 先置空列表,显示加载进度
  221. this.mescroll.resetUpScroll() // 再刷新列表数据
  222. }
  223. }
  224. }
  225. </script>
  226. <style lang='scss'>
  227. page,
  228. .content {
  229. background: #F5F6FA;
  230. }
  231. .flex {
  232. display: flex;
  233. }
  234. .alc {
  235. align-items: center;
  236. }
  237. .jcse {
  238. justify-content: space-evenly;
  239. }
  240. .jcsb {
  241. justify-content: space-between;
  242. }
  243. .top-warp {
  244. z-index: 998;
  245. position: fixed;
  246. top: --window-top;
  247. /* css变量 */
  248. left: 0;
  249. width: 100%;
  250. /* height: 120upx; */
  251. background-color: white;
  252. }
  253. .top-warp .tip {
  254. font-size: 28upx;
  255. height: 60upx;
  256. line-height: 60upx;
  257. text-align: center;
  258. }
  259. .slot-wrap {
  260. margin-right: 45rpx;
  261. font-size: 32rpx;
  262. }
  263. .list {
  264. margin: 0 20rpx;
  265. .list-item {
  266. padding: 20rpx;
  267. background: #fff;
  268. margin-bottom: 20rpx;
  269. border-radius: 20rpx;
  270. .row1 {
  271. .head-img {
  272. width: 72rpx;
  273. background-color: red;
  274. border-radius: 8rpx;
  275. margin-right: 22rpx;
  276. }
  277. .left {
  278. .title {
  279. font-weight: 700;
  280. color: #333333;
  281. }
  282. .bottom {
  283. .color1 {
  284. font-size: 24rpx;
  285. padding: 4rpx 10rpx;
  286. color: #fff;
  287. display: inline-block;
  288. background: linear-gradient(180deg, #607AE0 0%, #516CDC 100%);
  289. border-radius: 4rpx;
  290. }
  291. .color2 {
  292. font-size: 24rpx;
  293. padding: 4rpx 10rpx;
  294. color: #fff;
  295. display: inline-block;
  296. background: linear-gradient(180deg, #FD714F 0%, #FD613C 100%);
  297. border-radius: 4rpx;
  298. }
  299. .color3 {
  300. font-size: 28rpx;
  301. /* color: #AFB3BF; */
  302. margin-left: 14rpx;
  303. }
  304. }
  305. }
  306. .right {
  307. /* padding: 10rpx 20rpx; */
  308. }
  309. }
  310. .row2 {
  311. margin-top: 20rpx;
  312. /* overflow: hidden;
  313. text-overflow: ellipsis;
  314. width: 100%;
  315. display: -webkit-box;
  316. -webkit-box-orient: vertical;
  317. -webkit-line-clamp: 3;
  318. word-break: break-all; */
  319. }
  320. .row3 {
  321. /* padding: 30rpx 30rpx 0 30rpx; */
  322. margin-top: 18rpx;
  323. display: flex;
  324. align-items: center;
  325. /* justify-content: space-between; */
  326. flex-wrap: wrap;
  327. /* background: #bbb; */
  328. .img {
  329. display: flex;
  330. align-items: center;
  331. justify-content: center;
  332. width: 214rpx;
  333. height: 214rpx;
  334. margin-bottom: 20rpx;
  335. background: lightblue;
  336. list-style: none;
  337. border-radius: 10rpx;
  338. margin-right: 16rpx;
  339. }
  340. .img:nth-of-type(3),
  341. .img:nth-of-type(6),
  342. .img:nth-of-type(9) {
  343. margin-right: 0;
  344. }
  345. }
  346. .row4 {
  347. margin-top: 4rpx;
  348. .text {
  349. color: #878C9C;
  350. font-size: 24rpx;
  351. }
  352. }
  353. }
  354. .case {
  355. font-weight: 700;
  356. margin-left: 6rpx;
  357. }
  358. }
  359. .add {
  360. position: fixed;
  361. bottom: 250rpx;
  362. right: 32rpx;
  363. background: #22C572;
  364. z-index: 999;
  365. width: 84rpx;
  366. height: 84rpx;
  367. border-radius: 50%;
  368. display: flex;
  369. align-items: center;
  370. justify-content: center;
  371. }
  372. .search {
  373. display: flex;
  374. align-items: center;
  375. position: relative;
  376. margin: 20rpx 28rpx 20rpx 28rpx;
  377. .text {
  378. width: 90rpx;
  379. overflow: hidden;
  380. white-space: nowrap;
  381. text-overflow: ellipsis;
  382. }
  383. }
  384. /deep/.u-content {
  385. padding-left: 170rpx;
  386. }
  387. .place {
  388. display: flex;
  389. align-items: center;
  390. left: 28rpx;
  391. position: absolute;
  392. font-weight: 700;
  393. }
  394. .row5 {
  395. display: flex;
  396. justify-content: flex-end;
  397. margin-top: 20rpx;
  398. .btn {
  399. width: 120rpx;
  400. height: 66rpx;
  401. background: #FFFFFF;
  402. border-radius: 33px;
  403. border: 1px solid #CDCDCD;
  404. font-size: 28rpx;
  405. font-weight: 400;
  406. color: #333333;
  407. line-height: 66rpx;
  408. text-align: center;
  409. margin-left: 24rpx;
  410. }
  411. }
  412. </style>