profit.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <view class="app-content">
  3. <view class="ex-page">
  4. <view class="top-bar">
  5. <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" />
  6. </view>
  7. <scroll-view scroll-y scroll-with-animation class="main-view">
  8. <view class="space-view ex-table">
  9. <block>
  10. <t-table :headerBackgroundColor="'#F0F2F6'">
  11. <t-tr header>
  12. <t-th>类型</t-th>
  13. <t-th>金额</t-th>
  14. </t-tr>
  15. <block v-for="(item, inIndex) in profit.income" :key="inIndex">
  16. <t-tr v-if="Number(item.amount)>0">
  17. <t-td><view style="color:black;font-size:30upx;">{{item.name}}</view></t-td>
  18. <t-td><view style="color:black;font-size:30upx;">{{item.amount}}</view></t-td>
  19. </t-tr>
  20. </block>
  21. <!--同个节点v-for key重复会报错,所以再包一层-->
  22. <view>
  23. <block v-for="(item, exIndex) in profit.expend" :key="exIndex">
  24. <t-tr v-if="Number(item.amount)>0">
  25. <t-td><view style="color:black;font-size:30upx;">{{item.name}}</view></t-td>
  26. <t-td v-if="item.amount==0"><view style="color:black;font-size:30upx;">0</view></t-td>
  27. <t-td v-else><view style="color:black;font-size:30upx;">-{{item.amount}}</view></t-td>
  28. </t-tr>
  29. </block>
  30. </view>
  31. <t-tr>
  32. <t-td align="center">
  33. <view style="font-weight:bold;color:black;font-size:32upx;">利润 ¥{{profit.balance||0}}</view>
  34. </t-td>
  35. </t-tr>
  36. <block v-if="profit.wastagePrice && Number(profit.wastagePrice)>0">
  37. <t-tr>
  38. <t-td align="center">
  39. <view style="font-weight:bold;font-size:30upx;">
  40. 花材损耗 ¥{{profit.wastagePrice||0}}
  41. </view>
  42. </t-td>
  43. </t-tr>
  44. </block>
  45. </t-table>
  46. </block>
  47. </view>
  48. </scroll-view>
  49. </view>
  50. </view>
  51. </template>
  52. <script>
  53. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  54. import SelectList from "@/components/plugin/selectList";
  55. import { getStatProfit } from "@/api/stat/index";
  56. import { list } from "@/mixins";
  57. import ShopSelect from "@/components/module/shopSelect";
  58. import DateSelect from "@/components/module/dateSelect";
  59. import {mapActions, mapGetters} from "vuex";
  60. export default {
  61. components: { SelectList, AppWrapperEmpty,ShopSelect,DateSelect},
  62. mixins: [list],
  63. computed: {
  64. ...mapGetters(["getDictionariesInfo","getLoginInfo"])
  65. },
  66. data() {
  67. return {
  68. isShow:false,
  69. customizationTime:'',
  70. shopId:'',
  71. itemId:'',
  72. nowTime: "",
  73. showTimeDropdown: false,
  74. nowShop: "",
  75. showShopDropdown: false,
  76. dataList: [],
  77. params:{
  78. itemId: '',
  79. searchTime:'',
  80. startTime: "",
  81. endTime: "",
  82. shopId: "",
  83. },
  84. profit:[],
  85. };
  86. },
  87. onPullDownRefresh() {
  88. this.resetList();
  89. this._list().then(res => {
  90. uni.stopPullDownRefresh();
  91. });
  92. },
  93. onLoad(e) {
  94. this.itemId = e.id;
  95. this.params.itemId = e.id;
  96. this.shopId = this.getLoginInfo.shopId;
  97. },
  98. methods: {
  99. ...mapActions(['setUserShopAll']),
  100. //选择分店
  101. selectShopFn(val){
  102. this.params.shopId = val.id;
  103. this.init();
  104. },
  105. //选择时间
  106. selectDateFn(val) {
  107. this.params = {...this.params,...val}
  108. this.init();
  109. },
  110. async init() {
  111. this._list();
  112. },
  113. _list() {
  114. let that = this
  115. getStatProfit(this.params).then(res => {
  116. that.profit = res.data
  117. });
  118. }
  119. }
  120. };
  121. </script>
  122. <style lang="scss" scoped>
  123. .ex-page {
  124. background: white;
  125. height: 100%;
  126. display: flex;
  127. flex-direction: column;
  128. .top-bar {
  129. position: absolute;
  130. left: 0;
  131. display: flex;
  132. width: 100%;
  133. top:20upx;
  134. z-index: 20;
  135. .bar{
  136. width: 50%;
  137. height: 100%;
  138. text-align: center;
  139. &:nth-child(1){
  140. border-right: 1upx solid #eeeeec;
  141. }
  142. }
  143. }
  144. .main-view {
  145. margin-top: 80upx;
  146. flex: 1;
  147. background-color: #f9fbfc;
  148. .space-view {
  149. background-color: #fff;
  150. }
  151. .ex-info {
  152. padding: 30upx;
  153. .info-cell {
  154. display: flex;
  155. align-items: center;
  156. font-size: 28upx;
  157. &:not(:first-child) {
  158. margin-top: 20upx;
  159. }
  160. .cell-label {
  161. width: 110upx;
  162. color: #666666;
  163. }
  164. .cell-value {
  165. margin-left: 40upx;
  166. color: #333;
  167. &.warning {
  168. color: #ffaf1d;
  169. }
  170. &.success {
  171. color: #27c325;
  172. }
  173. }
  174. }
  175. }
  176. .ex-table {
  177. ::v-deep.icon-info {
  178. color: #333333;
  179. }
  180. }
  181. }
  182. .bar-view {
  183. display: flex;
  184. justify-content: space-between;
  185. align-items: center;
  186. padding: 0 30upx;
  187. width: 100%;
  188. height: 100upx;
  189. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  190. .info-view {
  191. font-size: 26upx;
  192. }
  193. .btn-view {
  194. display: flex;
  195. .admin-button-com {
  196. margin: 0 10upx;
  197. }
  198. }
  199. }
  200. }
  201. </style>