classProfit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <!--
  2. 分类利润:按花材分类汇总销售收入/采购成本/利润;timeType 切换记账时间(bill) / 发货时间(send)。
  3. -->
  4. <template>
  5. <view class="app-content">
  6. <view class="ex-page">
  7. <view class="top-bar">
  8. <!-- 记账时间 / 发货时间:只切换筛字段,不另开时间选择器 -->
  9. <view class="time-type-row">
  10. <view class="time-type-item" :class="{ active: params.timeType === 'bill' }" @click="changeTimeType('bill')">记账时间</view>
  11. <view class="time-type-item" :class="{ active: params.timeType === 'send' }" @click="changeTimeType('send')">发货时间</view>
  12. </view>
  13. <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" />
  14. </view>
  15. <scroll-view scroll-y scroll-with-animation class="main-view">
  16. <view class="space-view ex-table">
  17. <block>
  18. <t-table :headerBackgroundColor="'#F0F2F6'">
  19. <t-tr header>
  20. <t-th>名称</t-th>
  21. <t-th>销售收入</t-th>
  22. <t-th>采购成本</t-th>
  23. <t-th>花材利润</t-th>
  24. </t-tr>
  25. <t-tr v-for="(item, inIndex) in profit.list" :key="inIndex">
  26. <t-td><view style="color:black;font-size:26upx;">{{item.className}}</view></t-td>
  27. <t-td><view>{{item.income}}</view></t-td>
  28. <t-td><view>{{item.expend}}</view></t-td>
  29. <t-td><view>{{item.profit}}</view></t-td>
  30. </t-tr>
  31. <t-tr>
  32. <t-td><view style="color:black;font-size:24upx;font-weight:bold;color:#3385FF;">物流打包费</view></t-td>
  33. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">0</view></t-td>
  34. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">{{profit.packFreight?parseFloat(profit.packFreight):0}}</view></t-td>
  35. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">-{{profit.packFreight?parseFloat(profit.packFreight):0}}</view></t-td>
  36. </t-tr>
  37. <t-tr>
  38. <t-td><view style="color:black;font-size:24upx;font-weight:bold;color:#3385FF;">采购仅退款</view></t-td>
  39. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">{{profit.onlyRefundCg?parseFloat(profit.onlyRefundCg):0}}</view></t-td>
  40. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">0</view></t-td>
  41. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">{{profit.onlyRefundCg?parseFloat(profit.onlyRefundCg):0}}</view></t-td>
  42. </t-tr>
  43. <t-tr>
  44. <t-td><view style="color:black;font-size:24upx;font-weight:bold;color:#3385FF;">销售仅退款</view></t-td>
  45. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">0</view></t-td>
  46. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">{{profit.onlyRefund?parseFloat(profit.onlyRefund):0}}</view></t-td>
  47. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">-{{profit.onlyRefund?parseFloat(profit.onlyRefund):0}}</view></t-td>
  48. </t-tr>
  49. <t-tr>
  50. <t-td><view style="color:black;font-size:24upx;font-weight:bold;color:#3385FF;">人工费收入</view></t-td>
  51. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">{{profit.totalLabourCost?parseFloat(profit.totalLabourCost):0}}</view></t-td>
  52. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">0</view></t-td>
  53. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">{{profit.totalLabourCost?parseFloat(profit.totalLabourCost):0}}</view></t-td>
  54. </t-tr>
  55. <t-tr>
  56. <t-td><view style="color:black;font-size:24upx;font-weight:bold;color:#3385FF;">优惠金额</view></t-td>
  57. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">-{{profit.totalDiscountAmount?parseFloat(profit.totalDiscountAmount):0}}</view></t-td>
  58. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">0</view></t-td>
  59. <t-td><view style="color:black;font-size:24upx;color:#3385FF;">-{{profit.totalDiscountAmount?parseFloat(profit.totalDiscountAmount):0}}</view></t-td>
  60. </t-tr>
  61. <t-tr>
  62. <t-td><view style="color:black;font-size:24upx;font-weight:bold;color:#3385FF;">【汇总金额】</view></t-td>
  63. <t-td><view style="color:black;font-size:28upx;color:#3385FF;">{{profit.totalIncome}}</view></t-td>
  64. <t-td><view style="color:black;font-size:28upx;color:#3385FF;">{{profit.totalExpend}}</view></t-td>
  65. <t-td><view style="color:black;font-size:28upx;color:#3385FF;">{{profit.totalProfit}}</view></t-td>
  66. </t-tr>
  67. <view style="margin:10upx 60upx;color:#1c89e0;font-size:24upx;line-height:1.5;">
  68. 采购成本、销售收入已按售后扣减(跨天售后记在通过日,分类成本/收入可为负)。采购仅退款、销售仅退款含跨天通过日金额。与 PC 收支分类同源接口。
  69. </view>
  70. <view v-if="!$util.isEmpty(tbSaleIncome)">
  71. <t-tr>
  72. <t-td></t-td>
  73. <t-td></t-td>
  74. <t-td></t-td>
  75. <t-td></t-td>
  76. </t-tr>
  77. <view style="margin-left:60upx;font-size:26upx;font-weight:bold;margin-bottom:10upx;">销售单项统计</view>
  78. <view v-for="(it, idx) in tbSaleIncome" :key="idx">
  79. <t-tr>
  80. <t-td><view style="width:180upx;color:black;font-size:26upx;">{{it.name?it.name:'未命名'}}</view></t-td>
  81. <t-td><view style="color:black;font-size:26upx;">数量 {{it.num?it.num:0}}</view></t-td>
  82. <t-td><view style="color:black;font-size:28upx;">¥{{it.price?parseFloat(it.price):0}}</view></t-td>
  83. <t-td> <view> </view> </t-td>
  84. </t-tr>
  85. </view>
  86. </view>
  87. <view v-if="!$util.isEmpty(tbCgIncome)">
  88. <t-tr>
  89. <t-td></t-td>
  90. <t-td></t-td>
  91. <t-td></t-td>
  92. <t-td></t-td>
  93. </t-tr>
  94. <view style="margin-left:60upx;font-size:26upx;font-weight:bold;margin-bottom:10upx;">采购单项统计</view>
  95. <view v-for="(it, idx) in tbCgIncome" :key="idx">
  96. <t-tr>
  97. <t-td><view style="width:180upx;color:black;font-size:26upx;">{{it.name}}</view></t-td>
  98. <t-td><view style="color:black;font-size:26upx;">数量 {{it.num}}</view></t-td>
  99. <t-td><view style="color:black;font-size:28upx;">¥{{it.price?parseFloat(it.price):0}}</view></t-td>
  100. <t-td> <view> </view> </t-td>
  101. </t-tr>
  102. </view>
  103. </view>
  104. <t-tr>
  105. <t-td></t-td>
  106. <t-td></t-td>
  107. <t-td></t-td>
  108. <t-td></t-td>
  109. </t-tr>
  110. <view style="margin-left:60upx;">---------------------------</view>
  111. <view v-if="!$util.isEmpty(tbSaleIncomeStaff)">
  112. <view style="margin-left:60upx;font-size:26upx;font-weight:bold;margin-bottom:10upx;">销售单项统计(按人)</view>
  113. <view v-for="(it, idx) in tbSaleIncomeStaff" :key="idx">
  114. <view v-for="(itSon, idxSon) in it" :key="idxSon">
  115. <t-tr>
  116. <t-td><view style="width:180upx;color:black;font-size:26upx;">{{itSon.name?itSon.name:'未命名'}}</view></t-td>
  117. <t-td><view style="color:black;font-size:26upx;">数量 {{itSon.num?itSon.num:0}}</view></t-td>
  118. <t-td><view style="color:black;font-size:28upx;">¥{{itSon.price?parseFloat(itSon.price):0}}</view></t-td>
  119. <t-td> <view style="color:black;font-size:28upx;">{{ itSon.staffName||'' }}</view> </t-td>
  120. </t-tr>
  121. </view>
  122. </view>
  123. </view>
  124. <view v-if="!$util.isEmpty(tbCgIncomeStaff)">
  125. <t-tr>
  126. <t-td></t-td>
  127. <t-td></t-td>
  128. <t-td></t-td>
  129. <t-td></t-td>
  130. </t-tr>
  131. <view style="margin-left:60upx;font-size:26upx;font-weight:bold;margin-bottom:10upx;">采购单项统计(按人)</view>
  132. <view v-for="(it, idx) in tbCgIncomeStaff" :key="idx">
  133. <view v-for="(itSon, idxSon) in it" :key="idxSon">
  134. <t-tr>
  135. <t-td><view style="width:180upx;color:black;font-size:26upx;">{{itSon.name}}</view></t-td>
  136. <t-td><view style="color:black;font-size:26upx;">数量 {{itSon.num}}</view></t-td>
  137. <t-td><view style="color:black;font-size:28upx;">¥{{itSon.price?parseFloat(itSon.price):0}}</view></t-td>
  138. <t-td><view style="color:black;font-size:28upx;">{{ itSon.staffName||'' }}</view></t-td>
  139. </t-tr>
  140. </view>
  141. </view>
  142. </view>
  143. </t-table>
  144. </block>
  145. </view>
  146. </scroll-view>
  147. </view>
  148. </view>
  149. </template>
  150. <script>
  151. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  152. import { getClassProfit } from "@/api/stat";
  153. import { list } from "@/mixins";
  154. import ShopSelect from "@/components/module/shopSelect";
  155. import DateSelect from "@/components/module/dateSelect";
  156. import AppSearchModule from "@/components/module/app-search";
  157. import {mapActions, mapGetters} from "vuex";
  158. export default {
  159. components: { AppWrapperEmpty,ShopSelect,DateSelect,AppSearchModule},
  160. mixins: [list],
  161. computed: {
  162. ...mapGetters(["getDictionariesInfo","getLoginInfo"])
  163. },
  164. data() {
  165. return {
  166. isShow:false,
  167. customizationTime:'',
  168. shopId:'',
  169. itemId:'',
  170. nowTime: "",
  171. showTimeDropdown: false,
  172. nowShop: "",
  173. showShopDropdown: false,
  174. dataList: [],
  175. params:{
  176. itemId: '',
  177. searchTime:'',
  178. startTime: "",
  179. endTime: "",
  180. shopId: "",
  181. // bill=记账时间(默认) / send=发货时间
  182. timeType: 'bill',
  183. },
  184. profit:[],
  185. tbSaleIncome:[],
  186. tbCgIncome:[],
  187. tbSaleIncomeStaff:[],
  188. tbCgIncomeStaff:[]
  189. };
  190. },
  191. onPullDownRefresh() {
  192. this.resetList();
  193. this.getStatList().then(res => {
  194. uni.stopPullDownRefresh();
  195. });
  196. },
  197. onLoad(e) {
  198. this.itemId = e.id;
  199. this.params.itemId = e.id;
  200. this.shopId = this.getLoginInfo.shopId;
  201. },
  202. methods: {
  203. ...mapActions(['setUserShopAll']),
  204. //选择分店
  205. selectShopFn(val){
  206. this.params.shopId = val.id;
  207. this.init();
  208. },
  209. //选择时间
  210. selectDateFn(val) {
  211. this.params = {...this.params,...val}
  212. this.init();
  213. },
  214. /** 切换记账时间 / 发货时间并刷新 */
  215. changeTimeType(type) {
  216. if (this.params.timeType === type) return
  217. this.params.timeType = type
  218. this.init()
  219. },
  220. async init() {
  221. this.getStatList();
  222. },
  223. getStatList() {
  224. let that = this
  225. that.tbSaleIncome = []
  226. that.tbCgIncome = []
  227. that.tbSaleIncomeStaff = []
  228. that.tbCgIncomeStaff = []
  229. uni.showLoading({mask:true})
  230. getClassProfit(this.params).then(res => {
  231. uni.hideLoading()
  232. that.profit = res.data
  233. that.tbSaleIncome = res.data.tbSaleIncome?res.data.tbSaleIncome:[]
  234. that.tbCgIncome = res.data.tbCgIncome ? res.data.tbCgIncome : []
  235. that.tbSaleIncomeStaff = res.data.tbSaleIncomeStaff?res.data.tbSaleIncomeStaff:[]
  236. that.tbCgIncomeStaff = res.data.tbCgIncomeStaff ? res.data.tbCgIncomeStaff : []
  237. that.$forceUpdate()
  238. });
  239. }
  240. }
  241. };
  242. </script>
  243. <style lang="scss" scoped>
  244. .ex-page {
  245. background: white;
  246. padding-top:20upx;
  247. height: 100%;
  248. display: flex;
  249. flex-direction: column;
  250. .top-bar {
  251. position: absolute;
  252. left: 0;
  253. top:18upx;
  254. display: flex;
  255. align-items: center;
  256. width: 100%;
  257. z-index: 20;
  258. padding: 0 16upx;
  259. box-sizing: border-box;
  260. .time-type-row {
  261. display: flex;
  262. align-items: center;
  263. flex-shrink: 0;
  264. margin-right: 12upx;
  265. }
  266. .time-type-item {
  267. height: 56upx;
  268. line-height: 56upx;
  269. padding: 0 18upx;
  270. font-size: 26upx;
  271. color: #666;
  272. background: #f5f5f5;
  273. border-radius: 8upx;
  274. margin-right: 10upx;
  275. &:last-child {
  276. margin-right: 0;
  277. }
  278. &.active {
  279. color: #fff;
  280. background: #08b955;
  281. }
  282. }
  283. .bar{
  284. flex: 1;
  285. min-width: 0;
  286. height: 100%;
  287. text-align: center;
  288. }
  289. }
  290. .main-view {
  291. margin-top: 50upx;
  292. flex: 1;
  293. background-color: #f9fbfc;
  294. .space-view {
  295. background-color: #fff;
  296. }
  297. .ex-info {
  298. padding: 30upx;
  299. .info-cell {
  300. display: flex;
  301. align-items: center;
  302. font-size: 28upx;
  303. &:not(:first-child) {
  304. margin-top: 20upx;
  305. }
  306. .cell-label {
  307. width: 110upx;
  308. color: #666666;
  309. }
  310. .cell-value {
  311. margin-left: 40upx;
  312. color: #333;
  313. &.warning {
  314. color: #ffaf1d;
  315. }
  316. &.success {
  317. color: #27c325;
  318. }
  319. }
  320. }
  321. }
  322. .ex-table {
  323. ::v-deep.icon-info {
  324. color: #333333;
  325. }
  326. }
  327. }
  328. .bar-view {
  329. display: flex;
  330. justify-content: space-between;
  331. align-items: center;
  332. padding: 0 30upx;
  333. width: 100%;
  334. height: 100upx;
  335. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  336. .info-view {
  337. font-size: 26upx;
  338. }
  339. .btn-view {
  340. display: flex;
  341. .admin-button-com {
  342. margin: 0 10upx;
  343. }
  344. }
  345. }
  346. }
  347. </style>