酷炫直播运营系统小程序版本

addExpense.vue 6.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  1. <template>
  2. <view>
  3. <view class="title flex">
  4. <view class="flex">
  5. <view v-for="t in tabTilte" :key="t.id" class="rMar32 f32" @click="acIdx = t.id,init()">
  6. <view :class="t.id == acIdx ? 'acv' : ''">{{t.name}}</view>
  7. <view class="line" :class="t.id == acIdx ? 'acLine' : ''"></view>
  8. </view>
  9. </view>
  10. <!--
  11. <view class="c-B8B8B8 f24 rMar24" style="position: relative">
  12. <text class="iconfont icon-guize_icon f24 rMar10"></text>
  13. 报销规则
  14. <text class="explain" v-if="showexplain">晚8点之后和节假日打车费报销</text>
  15. </view>
  16. -->
  17. <view class="addExbtn" v-if="acIdx == 0" @click="addDocument_else({},0)">添加报销</view>
  18. </view>
  19. <view style="padding: 0 20rpx">
  20. <timeFiltrate @getchildTime="getchildTime"></timeFiltrate>
  21. </view>
  22. <view class="ec-table">
  23. <view class="flex ex-thead">
  24. <view class="date">日期</view>
  25. <view class="time">{{acIdx == 1 ? '实际下播时间' : '下班时间'}}</view>
  26. <view class="opa">操作</view>
  27. </view>
  28. <view class="ex-tbody">
  29. <view v-if="infoList&&infoList.length>0">
  30. <view v-for="item in infoList" :key="item.id" class="flex ex-tbody_item">
  31. <view class="date">{{item.date}}</view>
  32. <view class="time">{{item.off_time.split(' ')[1]}}</view>
  33. <view class="opa" v-if="acIdx == 1">
  34. <text @click="addDocument(item,0)" class="c-4F7EFF pointer" v-if="item.is_add_detail==0">添加报销单</text>
  35. <text @click="addDocument(item,1)" class="c-446EF6 pointer" v-else-if="item.is_add_detail==1&&item.if_edit==1">编辑报销单</text>
  36. <text @click="addDocument(item,2)" class="pointer c-F39F2F" v-else>查看</text>
  37. </view>
  38. <view class="opa" v-if="acIdx == 0">
  39. <text @click="addDocument_else(item,1)" class="c-446EF6 pointer" v-if="item.if_edit==1">编辑报销单</text>
  40. <text @click="addDocument_else(item,2)" class="pointer c-F39F2F" v-else>查看</text>
  41. </view>
  42. </view>
  43. </view>
  44. <noData v-else></noData>
  45. </view>
  46. </view>
  47. <view class="text-center f26 loadinfo" v-if="noMoreShow">没有更多了...</view>
  48. <view class="text-center f26 loadinfo" v-if="loadingShow">加载中...</view>
  49. <wm-watermark :text="real_name"></wm-watermark>
  50. <expenseConfig ref="showexpense"></expenseConfig>
  51. </view>
  52. </template>
  53. <script>
  54. import noData from "../../components/noData";
  55. import timeFiltrate from '@/components/timeFiltrate.vue'
  56. import expenseConfig from '@/components/expenseConfig.vue'
  57. export default {
  58. components: {
  59. timeFiltrate,
  60. noData,
  61. expenseConfig
  62. },
  63. data () {
  64. return {
  65. real_name: '',
  66. showexplain: false,
  67. infoList: [],
  68. total: 0,
  69. page: 1,
  70. pages: 0,
  71. page_size: 20,
  72. loading: false,
  73. start_time: this.$getDay(-30, false),
  74. end_time: this.$getDay(0, false),
  75. acIdx: 1,
  76. tabTilte: [
  77. {
  78. id: 1,
  79. name: '直播报销'
  80. },
  81. {
  82. id: 0,
  83. name: '其他报销'
  84. }
  85. ],
  86. info: {}, //info.reimburse_info
  87. noMoreShow:false,
  88. loadingShow:false
  89. }
  90. },
  91. computed: {
  92. timeChange () {
  93. const { start_time, end_time } = this
  94. return {
  95. start_time,
  96. end_time
  97. }
  98. }
  99. },
  100. watch: {
  101. timeChange () {//同时监听两个数据变化
  102. this.init()
  103. }
  104. },
  105. async onLoad () {
  106. await this.$onLaunched;
  107. this.$show_init_loading()
  108. this.real_name = uni.getStorageSync('userInfo').info.real_name;
  109. this.$refs.showexpense.closeDrawer()
  110. this.get_info()
  111. this.init()
  112. },
  113. onPullDownRefresh(){
  114. this.init()
  115. },
  116. onReachBottom(){
  117. if(this.infoList.length < this.page_size){
  118. this.noMoreShow = true
  119. return false
  120. }
  121. this.loadingShow = true
  122. setTimeout(()=>{
  123. this.init()
  124. },1000)
  125. },
  126. methods: {
  127. get_info () {
  128. this.$req(this.$api.dialogProfile, 'get', {}, (res) => {
  129. if (res && res.errno == 0) {
  130. this.info = res.rst
  131. this.$hide_init_loading()
  132. }
  133. })
  134. },
  135. addDocument_else (item, isEdit) {
  136. if (this.info.reimburse_info) {
  137. uni.navigateTo({
  138. url: '../addExpenseFormElse/addExpenseForm?item=' + encodeURIComponent(JSON.stringify(item)) + '&isEdit=' + isEdit
  139. })
  140. } else {
  141. this.$refs.showexpense.openDrawer()
  142. }
  143. },
  144. addDocument (item, isEdit) {
  145. // isEdit是否可编辑,0新增,1可编辑,2仅查看
  146. if (this.info.reimburse_info) {
  147. uni.navigateTo({
  148. url: '../addExpenseForm/addExpenseForm?item=' + encodeURIComponent(JSON.stringify(item)) + '&isEdit=' + isEdit
  149. })
  150. } else {
  151. this.$refs.showexpense.openDrawer()
  152. }
  153. },
  154. getchildTime (st, et) {
  155. this.start_time = st
  156. this.end_time = et
  157. },
  158. init () {
  159. this.infoList = []
  160. let api = this.$api.LiveReimbs
  161. if (this.acIdx == 0) {
  162. api = this.$api.reimbsList
  163. }
  164. this.$req(api, 'get', {
  165. staff_id: uni.getStorageSync('admin_id'),
  166. start: this.start_time,
  167. end: this.end_time,
  168. page: this.page,
  169. pagesize: this.page_size
  170. }, (res) => {
  171. if (res && res.errno == 0) {
  172. this.infoList=[...this.infoList,...res.rst.data]
  173. this.page = res.rst.pageInfo.page;
  174. uni.stopPullDownRefresh()
  175. } else if (res.errno != 4002) {
  176. this.$message({
  177. message: res.err,
  178. type: "warning"
  179. })
  180. }
  181. this.loadingShow = false
  182. this.$hide_init_loading()
  183. })
  184. }
  185. }
  186. }
  187. </script>
  188. <style lang="scss" scoped>
  189. .explain {
  190. position: absolute;
  191. top: 20rpx;
  192. }
  193. .title {
  194. font-size: 30rpx;
  195. padding: 40rpx 20rpx 0;
  196. .acv {
  197. color: #5b80f4;
  198. }
  199. .line {
  200. width: 70%;
  201. height: 3px;
  202. background-color: transparent;
  203. margin: 10rpx auto 0;
  204. }
  205. .acLine {
  206. background-color: #5b80f4;
  207. }
  208. }
  209. .addExbtn {
  210. padding: 10rpx 20rpx;
  211. background-color: #5b80f4;
  212. border-radius: 8rpx;
  213. margin-left: auto;
  214. }
  215. .ec-table {
  216. .ex-thead {
  217. padding: 18rpx 32rpx 26rpx;
  218. font-size: 26rpx;
  219. color: #b8b8b8;
  220. background: #1c222e;
  221. view {
  222. text-align: center;
  223. }
  224. }
  225. .ex-tbody {
  226. background-color: #373e4e;
  227. view {
  228. text-align: center;
  229. }
  230. .ex-tbody_item {
  231. padding: 30rpx 32rpx;
  232. border-bottom: 1px solid #3d4453;
  233. font-size: 28rpx;
  234. }
  235. }
  236. }
  237. .date {
  238. width: 25%;
  239. }
  240. .time {
  241. width: 50%;
  242. }
  243. .opa {
  244. width: 25%;
  245. }
  246. </style>