costbreakdown.vue 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347
  1. <template>
  2. <view>
  3. <view class='fixedbox'>
  4. <view class='search'>
  5. <u-search @search='getList' v-model='expenseName' placeholder='可按费用名称查找' search-icon-color='#AFB3BF'
  6. bg-color='#F5F6F9' :shape='"round"' :clearabled="true" :show-action='false'></u-search>
  7. </view>
  8. <view style='background:#fff;'>
  9. <view class='purposewrap'>
  10. <view :class='expensesPurpose==1?"active":""' @click='expenseclick(1)' class='item left'>合同费用</view>
  11. <view :class='expensesPurpose==3?"active":""' @click='expenseclick(3)' class='item'>库点费用</view>
  12. <view :class='expensesPurpose==5?"active":""' @click='expenseclick(5)' class='item right'>经营性费用
  13. </view>
  14. </view>
  15. </view>
  16. <view v-if='expensesPurpose==1' class='costwrap'>
  17. <view :class='costType==""?"active":""' @click='costTypeclick("")' class='item'>全部</view>
  18. <view :class='costType==1?"active":""' @click='costTypeclick(1)' class='item'>粮款</view>
  19. <view :class='costType==3?"active":""' @click='costTypeclick(3)' class='item'>非粮款</view>
  20. <view :class='costType==5?"active":""' @click='costTypeclick(5)' class='item'>保证金</view>
  21. </view>
  22. <view v-if='expensesPurpose==3' class='costwrap'>
  23. <view :class='wareExpenseType1==""?"active":""' @click='wareExpenseTypeclick("")' class='item'>全部</view>
  24. <view :class='wareExpenseType1=="煤费"?"active":""' @click='wareExpenseTypeclick("煤费")' class='item'>煤费
  25. </view>
  26. <view :class='wareExpenseType1=="电费"?"active":""' @click='wareExpenseTypeclick("电费")' class='item'>电费
  27. </view>
  28. <view :class='wareExpenseType1=="人工费"?"active":""' @click='wareExpenseTypeclick("人工费")' class='item'>人工费
  29. </view>
  30. <view :class='wareExpenseType1=="杂费"?"active":""' @click='wareExpenseTypeclick("杂费")' class='item'>杂费
  31. </view>
  32. <view :class='searchType==1?"active":""' @click='wareExpenseTypeclick(1)' class='item'>收款</view>
  33. </view>
  34. </view>
  35. <view v-if='costList.length>0' class='costlistwrap'>
  36. <view v-for='(item,index) in costList' :style='index!=costList.length-1?"border-bottom:2rpx solid #eee":""'
  37. class='item'>
  38. <view class='flex align-item-center'>
  39. <view v-if='item.expensesType==1' class="status income">收</view>
  40. <view v-if='item.expensesType==2' class="status pay">付</view>
  41. <view style='width:92%;justify-content: space-between;' class="flex align-item-center">
  42. <view class="costtype">{{item.expenseName}}</view>
  43. <view class="costmoney"><text>¥</text>{{item.amountMoney}}</view>
  44. </view>
  45. </view>
  46. <view style='justify-content: space-between;font-size:28rpx;margin:10rpx 0;'
  47. class='flex align-item-center'>
  48. <view v-if='item.expensesPurpose==3'>{{item.warehouseName}}</view>
  49. <view v-if='item.expensesPurpose==1'>{{item.contractNo}}</view>
  50. <view v-if='item.expensesPurpose==5'>{{item.paymentDate}}</view>
  51. <view>{{item.agent}}</view>
  52. </view>
  53. <view v-if='item.expensesPurpose==1||item.expensesPurpose==3' style='font-size:24rpx;margin:20rpx 0;'
  54. class='flex align-item-center'>
  55. <view class="">
  56. {{item.paymentDate}}
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view v-if='show' :style="{'margin-top':costList.length==0?'260rpx':'0'}"
  62. style='text-align:center;background:#F2F6FA;'>
  63. 暂无更多数据
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. export default {
  69. data() {
  70. return {
  71. expenseInfo: {
  72. startDate: '',
  73. endDate: ''
  74. },
  75. customBar: 0,
  76. costType: '',
  77. expensesPurpose: '1',
  78. currentPage: 1,
  79. show: false,
  80. wareExpenseType: '',
  81. wareExpenseType1: '',
  82. pageSize: 10,
  83. costList: [],
  84. isLoadMore: false,
  85. searchType: '',
  86. expenseName: ''
  87. }
  88. },
  89. onLoad(options) {
  90. // console.log(options.data)
  91. // if (options.type == 2) {
  92. // // 获取月份的天数
  93. // let _days = new Date(options.data.split('-')[0], options.data.split('-')[1], 0).getDate()
  94. // console.log(_days)
  95. // this.expenseInfo = {
  96. // startDate: options.data + '-01',
  97. // endDate: options.data + '-' + _days
  98. // }
  99. // } else if (options.type == 1) {
  100. // this.expenseInfo = {
  101. // startDate: options.data + '-01-01',
  102. // endDate: options.data + '-12-31'
  103. // }
  104. // }
  105. console.log(this.expenseInfo)
  106. uni.getSystemInfo({
  107. success: (e) => {
  108. // this.compareVersion(e.SDKVersion, '2.5.0')
  109. let statusBar = 0 //状态栏高度
  110. let customBar = 0 // 状态栏高度 + 导航栏高度
  111. let navbar = 0 // 自定义标题与胶囊对齐高度
  112. // #ifdef MP
  113. statusBar = e.statusBarHeight
  114. customBar = e.statusBarHeight + 45
  115. if (e.platform === 'android') {
  116. this.$store.commit('SET_SYSTEM_IOSANDROID', false)
  117. customBar = e.statusBarHeight + 50
  118. }
  119. // #endif
  120. // #ifdef MP-WEIXIN
  121. statusBar = e.statusBarHeight
  122. const custom = wx.getMenuButtonBoundingClientRect()
  123. customBar = custom.bottom + custom.top - e.statusBarHeight
  124. navbar = (custom.top - e.statusBarHeight) * 2 + custom.height
  125. // #endif
  126. // #ifdef MP-ALIPAY
  127. statusBar = e.statusBarHeight
  128. customBar = e.statusBarHeight + e.titleBarHeight
  129. // #endif
  130. // #ifdef APP-PLUS
  131. console.log('app-plus', e)
  132. statusBar = e.statusBarHeight
  133. customBar = e.statusBarHeight + 45
  134. // #endif
  135. // #ifdef H5
  136. statusBar = 0
  137. customBar = e.statusBarHeight + 45
  138. // #endif
  139. this.customBar = customBar
  140. }
  141. })
  142. },
  143. onShow() {
  144. this.getList()
  145. },
  146. onReachBottom() { //上拉触底函数
  147. // if (this.statusFlag == 3) {
  148. if (!this.show) { //此处判断,上锁,防止重复请求
  149. this.pageSize += 1
  150. this.currentPage += 1
  151. this.getList()
  152. }
  153. // }
  154. },
  155. methods: {
  156. wareExpenseTypeclick(status) {
  157. this.currentPage = 1
  158. if (status == 1) {
  159. this.searchType = 1
  160. this.wareExpenseType1 = 5
  161. this.wareExpenseType = ''
  162. } else {
  163. this.wareExpenseType1 = status
  164. this.wareExpenseType = status
  165. this.searchType = ''
  166. }
  167. this.getList()
  168. },
  169. costTypeclick(status) {
  170. this.show=false
  171. this.currentPage = 1
  172. this.costType = status
  173. this.getList()
  174. },
  175. expenseclick(status) {
  176. this.show=false
  177. this.currentPage = 1
  178. this.expensesPurpose = status
  179. this.getList()
  180. },
  181. getList() {
  182. uni.showLoading({
  183. title: "正在加载"
  184. })
  185. this.$api.doRequest('get', '/expenseInfo/selectInfo', {
  186. expensesPurpose: this.expensesPurpose,
  187. currentPage: this.currentPage,
  188. pageSize: this.pageSize,
  189. appFlag: 1,
  190. costType: this.costType,
  191. wareExpenseType: this.wareExpenseType,
  192. searchType: this.searchType,
  193. expenseName: this.expenseName,
  194. startDate: this.expenseInfo.startDate,
  195. endDate: this.expenseInfo.endDate,
  196. compId: uni.getStorageSync("pcUserInfo").compId
  197. }).then(res => {
  198. if (res.data.code) {
  199. uni.hideLoading()
  200. if (res.data.data.records.length > 0) {
  201. if (this.currentPage == 1) {
  202. this.costList = res.data.data.records
  203. } else {
  204. this.costList = this.costList.concat(res.data.data.records)
  205. }
  206. } else {
  207. this.show = true
  208. if (this.currentPage == 1) {
  209. this.costList = []
  210. }
  211. }
  212. } else {
  213. uni.hideLoading()
  214. uni.showToast({
  215. title: "系统异常,请联系管理员",
  216. icon: 'none',
  217. duration: 2000
  218. })
  219. }
  220. })
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang='scss' scoped>
  226. .fixedbox {
  227. position: fixed;
  228. width: 100%;
  229. top: 0;
  230. background: #fff;
  231. padding-top: 20rpx;
  232. }
  233. .purposewrap {
  234. display: flex;
  235. background: #fff;
  236. font-size: 32rpx;
  237. margin: 0 auto;
  238. width: 93%;
  239. .item {
  240. padding: 20rpx;
  241. color: #7A7A7A;
  242. width: 33.3333%;
  243. text-align: center;
  244. }
  245. .item.left {
  246. text-align: left;
  247. }
  248. .item.right {
  249. text-align: right;
  250. }
  251. .item.active {
  252. color: #262626;
  253. font-weight: 600;
  254. }
  255. }
  256. .costwrap {
  257. display: flex;
  258. margin: 10rpx 34rpx;
  259. .item {
  260. padding: 10rpx 20rpx;
  261. color: #333333;
  262. text-align: center;
  263. border-radius: 30rpx;
  264. }
  265. .item.active {
  266. color: #fff;
  267. background: #22C572;
  268. }
  269. }
  270. .costlistwrap {
  271. background: #fff;
  272. margin: 260rpx 20rpx 20rpx;
  273. border-radius: 20rpx;
  274. padding: 0 20rpx;
  275. .item {
  276. padding: 30rpx 0;
  277. .status {
  278. font-size: 24rpx;
  279. margin-right: 10rpx;
  280. padding: 4rpx 10rpx;
  281. border-radius: 10rpx;
  282. }
  283. .status.pay {
  284. background: #E9F8F0;
  285. color: #22C572;
  286. }
  287. .status.income {
  288. background: #FEECE6;
  289. color: #FE6430;
  290. }
  291. .costtype {
  292. font-size: 32rpx;
  293. font-weight: 600;
  294. }
  295. .costmoney {
  296. font-size: 36rpx;
  297. font-weight: 600;
  298. text {
  299. font-size: 26rpx;
  300. }
  301. }
  302. }
  303. }
  304. .search {
  305. width: 100vw;
  306. background: #fff;
  307. }
  308. .u-search {
  309. width: 94%;
  310. margin: 0 auto !important;
  311. }
  312. </style>