record.vue 12 KB

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