profit.vue 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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.wastageCost||0}} 售价¥{{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 AppSearchModule from "@/components/module/app-search";
  60. import {mapActions, mapGetters} from "vuex";
  61. export default {
  62. components: { SelectList, AppWrapperEmpty,ShopSelect,DateSelect,AppSearchModule},
  63. mixins: [list],
  64. computed: {
  65. ...mapGetters(["getDictionariesInfo","getLoginInfo"])
  66. },
  67. data() {
  68. return {
  69. isShow:false,
  70. customizationTime:'',
  71. shopId:'',
  72. itemId:'',
  73. nowTime: "",
  74. showTimeDropdown: false,
  75. nowShop: "",
  76. showShopDropdown: false,
  77. dataList: [],
  78. params:{
  79. itemId: '',
  80. searchTime:'',
  81. startTime: "",
  82. endTime: "",
  83. shopId: "",
  84. },
  85. profit:[],
  86. };
  87. },
  88. onPullDownRefresh() {
  89. this.resetList();
  90. this._list().then(res => {
  91. uni.stopPullDownRefresh();
  92. });
  93. },
  94. onLoad(e) {
  95. this.itemId = e.id;
  96. this.params.itemId = e.id;
  97. this.shopId = this.getLoginInfo.shopId;
  98. },
  99. methods: {
  100. ...mapActions(['setUserShopAll']),
  101. //选择分店
  102. selectShopFn(val){
  103. this.params.shopId = val.id;
  104. this.init();
  105. },
  106. //选择时间
  107. selectDateFn(val) {
  108. this.params = {...this.params,...val}
  109. this.init();
  110. },
  111. goClassProfit(){
  112. this.$util.pageTo({url: "/admin/stat/classProfit"})
  113. },
  114. async init() {
  115. this._list();
  116. },
  117. _list() {
  118. let that = this
  119. getStatProfit(this.params).then(res => {
  120. that.profit = res.data
  121. });
  122. }
  123. }
  124. };
  125. </script>
  126. <style lang="scss" scoped>
  127. .ex-page {
  128. background: white;
  129. padding-top:20upx;
  130. height: 100%;
  131. display: flex;
  132. flex-direction: column;
  133. .top-bar {
  134. position: absolute;
  135. left: 0;
  136. top:18upx;
  137. display: flex;
  138. width: 100%;
  139. z-index: 20;
  140. .bar{
  141. width: 50%;
  142. height: 100%;
  143. text-align: center;
  144. &:nth-child(1){
  145. border-right: 1upx solid #eeeeec;
  146. }
  147. }
  148. }
  149. .main-view {
  150. margin-top: 50upx;
  151. flex: 1;
  152. background-color: #f9fbfc;
  153. .space-view {
  154. background-color: #fff;
  155. }
  156. .ex-info {
  157. padding: 30upx;
  158. .info-cell {
  159. display: flex;
  160. align-items: center;
  161. font-size: 28upx;
  162. &:not(:first-child) {
  163. margin-top: 20upx;
  164. }
  165. .cell-label {
  166. width: 110upx;
  167. color: #666666;
  168. }
  169. .cell-value {
  170. margin-left: 40upx;
  171. color: #333;
  172. &.warning {
  173. color: #ffaf1d;
  174. }
  175. &.success {
  176. color: #27c325;
  177. }
  178. }
  179. }
  180. }
  181. .ex-table {
  182. ::v-deep.icon-info {
  183. color: #333333;
  184. }
  185. }
  186. }
  187. .bar-view {
  188. display: flex;
  189. justify-content: space-between;
  190. align-items: center;
  191. padding: 0 30upx;
  192. width: 100%;
  193. height: 100upx;
  194. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  195. .info-view {
  196. font-size: 26upx;
  197. }
  198. .btn-view {
  199. display: flex;
  200. .admin-button-com {
  201. margin: 0 10upx;
  202. }
  203. }
  204. }
  205. }
  206. </style>