finance-statistics.vue 10.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <view class="shop-statistics-container">
  3. <JHeader title="财务数据" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view>
  5. <view style="padding: 0 24upx;background-color: #ffffff;">
  6. <tui-tabs
  7. style="width: 702upx;padding: 0 0upx 0 0upx;overflow: hidden;" :slider-width="351" :padding="24"
  8. item-width="351rpx" selected-color="#000000" bold slider-bg-color="#ff0000"
  9. :tabs="[{ name: '日汇款' }, { name: '月汇款' }]" :current-tab="currentTab" @change="handleCurrentChange"
  10. ></tui-tabs>
  11. </view>
  12. <view style="margin: 10upx 0;text-align: right;">
  13. <tui-button
  14. type="blue" width="220rpx" height="60rpx" margin="0 30upx 0 0"
  15. style="display: inline-block;border-radius: 30rpx;" @click="$refs.dateTimeFinance.show()"
  16. >
  17. 选择日期
  18. </tui-button>
  19. <tui-datetime
  20. ref="dateTimeFinance" :type="3" radius
  21. :end-year="Number(new Date(Date.now()).toLocaleString().substring(0, 4))"
  22. @confirm="handleConfirmTime"
  23. ></tui-datetime>
  24. </view>
  25. <view
  26. style="width: 100%;color: #000;padding: 14upx 24upx 44upx;box-sizing: border-box;margin-top: 2upx;margin-bottom: 20upx;background-color: #ffa637;border-radius: 20upx;font-size: 28upx;"
  27. >
  28. <view style="text-align: right;">
  29. <tui-button
  30. type="primary" width="140rpx" height="60rpx" margin="0 20upx 0 0"
  31. style="display: inline-block;border-radius: 30rpx;" @click="isShowRechargeDialog = true"
  32. >
  33. 提现
  34. </tui-button>
  35. <tui-button
  36. v-if="type === 'order'" type="primary" width="140rpx" height="60rpx"
  37. margin="0 20upx 0 0"
  38. style="display: inline-block;border-radius: 30rpx;"
  39. @click="(isShowWithdrawalDetailsPopup = true) && $refs.refOrderWithdrawalDetails && $refs.refOrderWithdrawalDetails.getShopWithdrawalDetails()"
  40. >
  41. 明细
  42. </tui-button>
  43. <tui-button
  44. v-if="type === 'recharge'" type="primary" width="240rpx" height="60rpx"
  45. margin="0 20upx 0 0"
  46. style="display: inline-block;border-radius: 30rpx;"
  47. @click="(isShowCustomBusinessPopup = true) && $refs.refRechargeCustomBusiness && $refs.refRechargeCustomBusiness.getShopRechargeCustom()"
  48. >
  49. 客户充值统计
  50. </tui-button>
  51. </view>
  52. <view style="margin-top: 20upx;">
  53. <view style="display: flex;justify-content: space-evenly;flex-wrap: wrap;align-items: stretch;">
  54. <view
  55. style="display: flex;flex-direction: column;justify-content: space-between;width: 30%;margin-top: 10upx;padding: 18upx 6upx;color: #FFFFFF;text-align: center;border-radius: 24px;background: #ffc377;border: 2px solid #ffcc8d;"
  56. >
  57. <view>累计营业额(元)</view>
  58. <view style="font-size: 40upx;font-weight: bold;margin-top: 4upx;">
  59. {{ typeof financeStatisticsData.turnover === 'number' ? financeStatisticsData.turnover : '--' }}
  60. </view>
  61. </view>
  62. <view
  63. style="display: flex;flex-direction: column;justify-content: space-between;width: 30%;margin-top: 10upx;padding: 18upx 6upx;color: #FFFFFF;text-align: center;border-radius: 24px;background: #ffc377;border: 2px solid #ffcc8d;"
  64. >
  65. <view>冻结金额(元)</view>
  66. <view style="font-size: 40upx;font-weight: bold;margin-top: 4upx;">
  67. {{ typeof financeStatisticsData.frozenMoney === 'number' ? financeStatisticsData.frozenMoney : '--' }}
  68. </view>
  69. </view>
  70. <view
  71. style="display: flex;flex-direction: column;justify-content: space-between;width: 30%;margin-top: 10upx;padding: 18upx 6upx;color: #FFFFFF;text-align: center;border-radius: 24px;background: #ffc377;border: 2px solid #ffcc8d;"
  72. >
  73. <view>可提现金额(元)</view>
  74. <view style="font-size: 40upx;font-weight: bold;margin-top: 4upx;">
  75. {{ typeof financeStatisticsData.withdrawableMoney === 'number' ? financeStatisticsData.withdrawableMoney
  76. : '--' }}
  77. </view>
  78. </view>
  79. <view
  80. style="display: flex;flex-direction: column;justify-content: space-between;width: 30%;margin-top: 10upx;padding: 18upx 6upx;color: #FFFFFF;text-align: center;border-radius: 24px;background: #ffc377;border: 2px solid #ffcc8d;"
  81. >
  82. <view>提现中(元)</view>
  83. <view style="font-size: 40upx;font-weight: bold;margin-top: 4upx;">
  84. {{ typeof financeStatisticsData.withdrawableStayMoney === 'number'
  85. ? financeStatisticsData.withdrawableStayMoney : '--' }}
  86. </view>
  87. </view>
  88. <view
  89. style="display: flex;flex-direction: column;justify-content: space-between;width: 30%;margin-top: 10upx;padding: 18upx 6upx;color: #FFFFFF;text-align: center;border-radius: 24px;background: #ffc377;border: 2px solid #ffcc8d;"
  90. >
  91. <view>赠送代金券</view>
  92. <view style="font-size: 40upx;font-weight: bold;margin-top: 4upx;">
  93. {{ typeof financeStatisticsData.presenterVoucher === 'number' ? financeStatisticsData.presenterVoucher
  94. : '--' }}
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. </view>
  100. <view style="padding: 20upx;">
  101. <view v-if="financeStatisticsData.finances && financeStatisticsData.finances.length">
  102. <tui-table>
  103. <tui-tr>
  104. <tui-td bold :span="8">日期</tui-td>
  105. <tui-td bold :span="8">收入(元)</tui-td>
  106. <tui-td bold :span="8">支出(元)</tui-td>
  107. </tui-tr>
  108. <tui-tr v-for="(item, index) in financeStatisticsData.finances" :key="index">
  109. <tui-td :span="8">{{ item.time }}</tui-td>
  110. <tui-td :span="8">{{ item.income }}</tui-td>
  111. <tui-td :span="8">{{ item.expenditure }}</tui-td>
  112. </tui-tr>
  113. </tui-table>
  114. </view>
  115. <view style="padding-bottom: 45upx;">
  116. <LoadingMore :status="isLoading ? 'loading' : ''"></LoadingMore>
  117. <view v-if="!isLoading && !financeStatisticsData.finances.length">
  118. <tui-no-data :fixed="false" style="padding-top: 60upx;">暂无具体数据</tui-no-data>
  119. </view>
  120. </view>
  121. </view>
  122. </view>
  123. <view v-if="type === 'order'">
  124. <tui-bottom-popup :show="isShowWithdrawalDetailsPopup" @close="isShowWithdrawalDetailsPopup = false">
  125. <view style="height: 100%;padding: 20upx;overflow-y: auto;box-sizing: border-box;">
  126. <OrderWithdrawalDetails ref="refOrderWithdrawalDetails"></OrderWithdrawalDetails>
  127. </view>
  128. </tui-bottom-popup>
  129. </view>
  130. <view v-else-if="type === 'recharge'">
  131. <tui-bottom-popup :show="isShowCustomBusinessPopup" @close="isShowCustomBusinessPopup = false">
  132. <view style="height: 100%;padding: 20upx;overflow-y: auto;box-sizing: border-box;">
  133. <RechargeCustomBusiness ref="refRechargeCustomBusiness"></RechargeCustomBusiness>
  134. </view>
  135. </tui-bottom-popup>
  136. </view>
  137. <!-- 提现相关dialog -->
  138. <tui-dialog
  139. style="position: relative;z-index: 888;" :buttons="[{ text: '取消' }, { text: '确认提现', color: '#586c94' }]"
  140. :show="isShowRechargeDialog" title="订单财务提现" @click="handleRechargeDialog"
  141. >
  142. <template #content>
  143. <view>
  144. <tui-input v-model="rechargeNum" padding="26upx 0" label="提现金额" type="number" placeholder="请填写提现金额"></tui-input>
  145. </view>
  146. </template>
  147. </tui-dialog>
  148. </view>
  149. </template>
  150. <script>
  151. import { getShopBankApi, getShopFinanceCountApi, addShopWithdrawalApi, getShopRechargeCountApi, addShopWithdrawalRechargeApi } from '../../../api/anotherTFInterface'
  152. import OrderWithdrawalDetails from './components/OrderWithdrawalDetails.vue'
  153. import RechargeCustomBusiness from './components/RechargeCustomBusiness.vue'
  154. export default {
  155. name: 'FinanceStatistics',
  156. components: { OrderWithdrawalDetails, RechargeCustomBusiness },
  157. data() {
  158. return {
  159. type: '',
  160. currentTab: 1,
  161. financeStatisticsData: {
  162. turnover: '',
  163. frozenMoney: '',
  164. withdrawableMoney: '',
  165. withdrawableStayMoney: '',
  166. presenterVoucher: '',
  167. finances: []
  168. },
  169. queryInfo: {
  170. condition: 2,
  171. time: ''
  172. },
  173. isLoading: true,
  174. // 下拉弹框
  175. isShowWithdrawalDetailsPopup: false,
  176. isShowCustomBusinessPopup: false,
  177. // 提现相关
  178. isShowRechargeDialog: false,
  179. rechargeNum: ''
  180. }
  181. },
  182. onLoad(options) {
  183. this.type = options.type || 'order'
  184. this.getFinanceStatistics()
  185. },
  186. methods: {
  187. handleCurrentChange(e) {
  188. this.currentTab = e.index
  189. this.queryInfo.condition = this.currentTab + 1
  190. this.queryInfo.time = ''
  191. this.getFinanceStatistics()
  192. },
  193. getFinanceStatistics() {
  194. this.isLoading = true
  195. let api
  196. if (this.type === 'order') api = getShopFinanceCountApi
  197. else if (this.type === 'recharge') api = getShopRechargeCountApi
  198. api({ ...this.queryInfo })
  199. .then((res) => {
  200. this.financeStatisticsData = res.data
  201. this.isLoading = false
  202. })
  203. .catch(() => {
  204. this.isLoading = false
  205. })
  206. },
  207. handleConfirmTime(e) {
  208. console.log(e.result)
  209. this.queryInfo.time = e.result
  210. this.getFinanceStatistics()
  211. },
  212. handleRechargeDialog(e) {
  213. console.log(e)
  214. if (e.index === 0) {
  215. this.rechargeNum = ''
  216. this.isShowRechargeDialog = false
  217. } else if (e.index === 1) {
  218. if (!this.rechargeNum) return this.$showToast('请填写提现金额')
  219. uni.showLoading()
  220. getShopBankApi({})
  221. .then((result) => {
  222. let api
  223. if (this.type === 'order') api = addShopWithdrawalApi
  224. else if (this.type === 'recharge') api = addShopWithdrawalRechargeApi
  225. api({
  226. shopName: result.data.shopName,
  227. shopCode: result.data.shopCode,
  228. bankName: result.data.bankName,
  229. bankCard: result.data.bankCard,
  230. withdrawalMoney: this.rechargeNum
  231. })
  232. .then((res) => {
  233. uni.hideLoading()
  234. this.rechargeNum = ''
  235. this.isShowRechargeDialog = false
  236. this.$showToast('提现成功', 'success')
  237. })
  238. .catch(() => {
  239. uni.hideLoading()
  240. })
  241. })
  242. .catch(() => {
  243. uni.hideLoading()
  244. })
  245. }
  246. }
  247. }
  248. }
  249. </script>
  250. <style lang="less" scoped>
  251. .shop-statistics-container {
  252. min-height: 100vh;
  253. width: 100%;
  254. background: #f6f6f6;
  255. box-sizing: border-box;
  256. .tui-tabs-view {
  257. /deep/ .tui-tabs-slider {
  258. margin-left: -24upx;
  259. }
  260. }
  261. /deep/ .tui-popup-class.tui-bottom-popup {
  262. height: 85vh !important;
  263. }
  264. }
  265. </style>