RevenueList.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  1. <template>
  2. <view>
  3. <cu-custom bgColor="bg-blue" :isBack="true">
  4. <block slot="content">企业税收</block>
  5. </cu-custom>
  6. <view :style="[{top:CustomBar + 'px'}]">
  7. <view class="cu-bar search">
  8. <view class="search-form bg-white round">
  9. <text class="cuIcon-search"></text>
  10. <input type="text" placeholder="搜索" v-model="curWord" confirm-type="search"
  11. @input="inputWord"></input>
  12. </view>
  13. </view>
  14. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" :up="upOption" @up="upCallback">
  15. <view class="cu-item" :class="modalName=='move-box-'+ index?'move-cur':''"
  16. v-for="(row, index) in dataList" :key="index" @touchstart="ListTouchStart"
  17. @touchmove="ListTouchMove" @touchend="ListTouchEnd" :data-target="'move-box-' + index">
  18. <view class="cu-bar bg-white solid-bottom">
  19. <view class="action">
  20. <text class="cuIcon-titles text-orange "></text># {{index + 1}}
  21. </view>
  22. <view class="action">
  23. <button class="uni-button" size="mini" @click="edit(row.id)" type="primary">修改</button>
  24. <button class="uni-button" size="mini" @click="del(row.id)" type="warn">删除</button>
  25. </view>
  26. </view>
  27. <view class="cu-card dynamic no-card">
  28. <view class="cu-item shadow">
  29. <view class="cu-list menu-avatar comment solids-top">
  30. <view class="cu-item">
  31. <view class="content">
  32. <view class=" margin-top-sm text-sm">
  33. <view class="flex">
  34. <view> 企业:</view>
  35. <view class="flex-sub">
  36. {{row.qyName}}
  37. </view>
  38. </view>
  39. </view>
  40. <view class=" margin-top-sm text-sm">
  41. <view class="flex">
  42. <view> 类别:</view>
  43. <view class="flex-sub">
  44. {{ $dictUtils.getDictLabel("s_lb", row.lb, '-') }}
  45. </view>
  46. </view>
  47. </view>
  48. <view class=" margin-top-sm text-sm">
  49. <view class="flex">
  50. <view> 税源办:</view>
  51. <view class="flex-sub">
  52. {{ $dictUtils.getDictLabel("yes_no", row.des3, '-') }}
  53. </view>
  54. </view>
  55. </view>
  56. <view class=" margin-top-sm text-sm" v-if="row.des3 !=='1'">
  57. <view class="flex">
  58. <view> 月份:</view>
  59. <view class="flex-sub">
  60. {{ row.des1 }}
  61. </view>
  62. </view>
  63. </view>
  64. <view class=" margin-top-sm text-sm" v-if="row.des3 ==='1'">
  65. <view class="flex">
  66. <view> 开始月份:</view>
  67. <view class="flex-sub">
  68. {{ row.des1 }}
  69. </view>
  70. </view>
  71. </view>
  72. <view class=" margin-top-sm text-sm" v-if="row.des3 ==='1'">
  73. <view class="flex">
  74. <view> 结束月份:</view>
  75. <view class="flex-sub">
  76. {{ row.des2 }}
  77. </view>
  78. </view>
  79. </view>
  80. <view class=" margin-top-sm text-sm">
  81. <view class="flex">
  82. <view> 金额(万元):</view>
  83. <view class="flex-sub">
  84. {{ row.amount }}
  85. </view>
  86. </view>
  87. </view>
  88. <view class=" margin-top-sm text-sm">
  89. <view class="flex">
  90. <view> 备注:</view>
  91. <view class="flex-sub">
  92. {{ row.remark }}
  93. </view>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. </view>
  101. </view>
  102. </mescroll-body>
  103. <uni-fab :pattern=" {
  104. color: '#7A7E83',
  105. backgroundColor: '#fff',
  106. selectedColor: '#007AFF',
  107. buttonColor: '#007AFF'
  108. }" horizontal="right" vertical="bottom" @fabClick="add"></uni-fab>
  109. </view>
  110. </view>
  111. </template>
  112. <script>
  113. import uniFab from '@/components/uni-fab/uni-fab.vue';
  114. import revenueListService from '@/api/revenue/revenueListService'
  115. import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
  116. import MescrollMoreItemMixin from "@/components/mescroll-uni/mixins/mescroll-more-item.js";
  117. export default {
  118. mixins: [MescrollMixin, MescrollMoreItemMixin], // 使用mixin (在main.js注册全局组件)
  119. onShow(option) {
  120. this.$auth.checkLogin()
  121. },
  122. components: {
  123. uniFab
  124. },
  125. data() {
  126. return {
  127. searchForm: {},
  128. curWord: "", //当前搜索关键词
  129. dataList: [], // 数据列表
  130. modalName: null,
  131. tablePage: {
  132. total: 0,
  133. currentPage: 1,
  134. pageSize: 10,
  135. orders: []
  136. },
  137. loading: false
  138. }
  139. },
  140. methods: {
  141. // 新增
  142. add() {
  143. uni.navigateTo({
  144. url: '/pages/revenue/RevenueForm'
  145. })
  146. },
  147. // 修改
  148. edit(id) {
  149. uni.navigateTo({
  150. url: '/pages/revenue/RevenueForm?id=' + id
  151. })
  152. },
  153. // 删除
  154. del(id) {
  155. uni.showModal({
  156. title: '提示',
  157. content: '您确认要删除数据吗',
  158. showCancel: true,
  159. success: (res) => {
  160. if (res.confirm) {
  161. revenueListService.delete(id).then(({
  162. data
  163. }) => {
  164. uni.showToast({
  165. title: data,
  166. icon: "success"
  167. })
  168. this.doSearch()
  169. })
  170. }
  171. }
  172. });
  173. },
  174. /*获取数据列表 */
  175. upCallback(page) {
  176. this.loading = true
  177. revenueListService.list({
  178. current: page.num,
  179. size: page.size,
  180. ...this.searchForm
  181. }).then(({
  182. data
  183. }) => {
  184. let curPageData = data.records
  185. this.mescroll.endBySize(curPageData.length, data.total);
  186. //如果是第一页需手动制空列表
  187. if (page.num == 1)
  188. this.dataList = [];
  189. //追加新数据
  190. this.dataList = this.dataList.concat(curPageData);
  191. }).catch(e => {
  192. //联网失败, 结束加载
  193. this.mescroll.endErr();
  194. })
  195. },
  196. // 输入监听
  197. inputWord(e) {
  198. // this.curWord = e.detail.value // 已使用v-model,无需再次赋值
  199. // 节流,避免输入过快多次请求
  200. this.searchTimer && clearTimeout(this.searchTimer)
  201. this.searchTimer = setTimeout(() => {
  202. this.doSearch(this.curWord)
  203. }, 300)
  204. },
  205. // 搜索
  206. doSearch(word) {
  207. this.curWord = word
  208. this.dataList = []; // 先清空列表,显示加载进度
  209. this.mescroll.resetUpScroll();
  210. },
  211. // ListTouch触摸开始
  212. ListTouchStart(e) {
  213. this.listTouchStart = e.touches[0].pageX
  214. },
  215. // ListTouch计算方向
  216. ListTouchMove(e) {
  217. this.listTouchDirection = e.touches[0].pageX - this.listTouchStart > -60 ? 'right' : 'left'
  218. },
  219. // ListTouch计算滚动
  220. ListTouchEnd(e) {
  221. if (this.listTouchDirection == 'left') {
  222. this.modalName = e.currentTarget.dataset.target
  223. } else {
  224. this.modalName = null
  225. }
  226. this.listTouchDirection = null
  227. }
  228. }
  229. }
  230. </script>
  231. <style>
  232. .ellipsis-description {
  233. font-size: 12px;
  234. line-height: $line-height-base;
  235. display: -webkit-box;
  236. /*作为弹性伸缩盒子模型显示*/
  237. -webkit-line-clamp: 1;
  238. /*显示的行数;如果要设置2行加...则设置为2*/
  239. overflow: hidden;
  240. /*超出的文本隐藏*/
  241. text-overflow: ellipsis;
  242. /* 溢出用省略号*/
  243. -webkit-box-orient: vertical;
  244. /*伸缩盒子的子元素排列:从上到下*/
  245. }
  246. .cu-bar .search-form {
  247. background-color: white;
  248. }
  249. </style>