index.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371
  1. <template>
  2. <view class="finance-statistics-container">
  3. <JHeader title="加盟商统计" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view
  5. style="padding: 8upx 0 0;text-align: center;color: #ffffff;background: linear-gradient(90deg, #EF530E 0%, #EF530E 100%);overflow: hidden;"
  6. >
  7. <view
  8. style="display: flex;justify-content: space-evenly;margin-top: 4upx;padding: 20upx 0;background: linear-gradient(0deg, rgba(255, 255, 255, 0.0001) 0%, rgba(255, 255, 255, 0.15) 99%);"
  9. >
  10. <view style="flex: 1;">
  11. <view style="color: #f7a783;">今日收益</view>
  12. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.todayIncome || 0 }}</view>
  13. </view>
  14. <view style="width: 2upx;background-color: #f37d49;"></view>
  15. <view style="flex: 1;">
  16. <view style="color: #f7a783;">预计收益</view>
  17. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.wayIncome || 0 }}</view>
  18. </view>
  19. <view style="width: 2upx;background-color: #f37d49;"></view>
  20. <view style="flex: 1;">
  21. <view style="color: #f7a783;">累计收益</view>
  22. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.accumulateIncome || 0 }}</view>
  23. </view>
  24. <view style="width: 2upx;background-color: #f37d49;"></view>
  25. <view style="flex: 1;">
  26. <view style="color: #f7a783;">商家数</view>
  27. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.shopNum || 0 }}</view>
  28. </view>
  29. </view>
  30. <view
  31. style="display: flex;justify-content: space-evenly;margin-top: 4upx;padding: 20upx 0;background: linear-gradient(0deg, rgba(255, 255, 255, 0.0001) 0%, rgba(255, 255, 255, 0.15) 99%);"
  32. >
  33. <view style="flex: 1;">
  34. <view style="color: #f7a783;">今日团长</view>
  35. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.TZTodayNum || 0 }}</view>
  36. </view>
  37. <view style="width: 2upx;background-color: #f37d49;"></view>
  38. <view style="flex: 1;">
  39. <view style="color: #f7a783;">累计团长</view>
  40. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.TZAccumulateNum || 0 }}</view>
  41. </view>
  42. <view style="width: 2upx;background-color: #f37d49;"></view>
  43. <view style="flex: 1;">
  44. <view style="color: #f7a783;">今日合伙人</view>
  45. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.HHTodayNum || 0 }}</view>
  46. </view>
  47. <view style="width: 2upx;background-color: #f37d49;"></view>
  48. <view style="flex: 1;">
  49. <view style="color: #f7a783;">累计合伙人</view>
  50. <view style="margin-top: 10upx;">{{ franchiseeStatisticsData.HHAccumulateNum || 0 }}</view>
  51. </view>
  52. </view>
  53. </view>
  54. <view style="padding: 0 24upx;background-color: #ffffff;">
  55. <tui-tabs
  56. style="width: 702upx;padding: 0 0upx 0 0upx;overflow: hidden;" :slider-width="351" :padding="24"
  57. item-width="351rpx" selected-color="#000000" bold slider-bg-color="#ff0000"
  58. :tabs="[{ name: '商家' }, { name: '团长/合伙人' }]" :current-tab="currentTab" @change="handleCurrentChange"
  59. ></tui-tabs>
  60. </view>
  61. <view style="padding: 20upx;">
  62. <view v-if="currentTab === 0">
  63. <view style="display: flex;justify-content: flex-end;">
  64. <tui-dropdown-list
  65. :show="shopDropdownShow" :top="55" background-color="#ffffff"
  66. @close="shopDropdownShow = false"
  67. >
  68. <template #selectionbox>
  69. <view style="height: auto;color: #080808;" @click="shopDropdownShow = !shopDropdownShow">
  70. <text>类型∨</text>
  71. <text style="margin-left: 10upx;;font-size: 26upx;">{{ shopDropdownName || '' }}</text>
  72. </view>
  73. </template>
  74. <template #dropdownbox>
  75. <view style="width: fit-content;box-sizing: border-box;">
  76. <tui-list-view
  77. title="" color="#777" margin-top="2rpx"
  78. style="width: fit-content;min-width: 150upx;max-height: 28vh;overflow-y: auto;"
  79. >
  80. <tui-list-cell
  81. padding="20rpx 0"
  82. style="width: fit-content;margin: 0 auto;border-bottom: 2upx solid #cccccc;"
  83. @click="((franchiseeShopInfo.query.type = 6) && (shopDropdownName = '今日收益') && (shopDropdownShow = false)) || getFranchiseeShopList()"
  84. >
  85. 今日收益
  86. </tui-list-cell>
  87. <tui-list-cell
  88. padding="20rpx 0"
  89. style="width: fit-content;margin: 0 auto;border-bottom: 2upx solid #cccccc;"
  90. @click="((franchiseeShopInfo.query.type = 7) && (shopDropdownName = '预计收益') && (shopDropdownShow = false)) || getFranchiseeShopList()"
  91. >
  92. 预计收益
  93. </tui-list-cell>
  94. <tui-list-cell
  95. padding="20rpx 0"
  96. style="width: fit-content;margin: 0 auto;border-bottom: 2upx solid #cccccc;"
  97. @click="((franchiseeShopInfo.query.type = 8) && (shopDropdownName = '累计收益') && (shopDropdownShow = false)) || getFranchiseeShopList()"
  98. >
  99. 累计收益
  100. </tui-list-cell>
  101. </tui-list-view>
  102. </view>
  103. </template>
  104. </tui-dropdown-list>
  105. </view>
  106. <tui-list-view v-if="franchiseeShopInfo.data && franchiseeShopInfo.data.length" margin-top="20upx" title="">
  107. <tui-list-cell v-for="(item, index) in franchiseeShopInfo.data" :key="item.id">
  108. <view style="display: flex;align-items: center;">
  109. <JAvatar :src="common.seamingImgUrl(item.shopLogo)" :size="80" style="margin: 0 24upx 0 0;line-height: 1;"></JAvatar>
  110. <view style="flex: 1;">
  111. <view style="display: flex;justify-content: space-between;">
  112. <view>{{ item.shopName }}</view>
  113. <view>{{ item.createTime || '--' }}</view>
  114. </view>
  115. <view style="display: flex;justify-content: space-between;">
  116. <view>今日:¥{{ item.todayPrice || '--' }}</view>
  117. <view>预计:¥{{ item.beToPrice || '--' }}</view>
  118. <view>总:¥{{ item.allPrice || '--' }}</view>
  119. </view>
  120. </view>
  121. </view>
  122. </tui-list-cell>
  123. </tui-list-view>
  124. <view style="padding-bottom: 45upx;">
  125. <LoadingMore
  126. :status="!franchiseeShopInfo.isEmpty && !franchiseeShopInfo.data.length
  127. ? 'loading' : !franchiseeShopInfo.isEmpty && franchiseeShopInfo.data.length && (franchiseeShopInfo.data.length >= franchiseeShopInfo.listTotal) ? 'no-more' : ''"
  128. >
  129. </LoadingMore>
  130. <tui-no-data v-if="franchiseeShopInfo.isEmpty" :fixed="false" style="margin-top: 60upx;">暂无提问内容</tui-no-data>
  131. </view>
  132. </view>
  133. <view v-else-if="currentTab === 1">
  134. <view style="display: flex;justify-content: flex-end;">
  135. <tui-dropdown-list
  136. :show="commanderDropdownShow" :top="55" background-color="#ffffff"
  137. @close="commanderDropdownShow = false"
  138. >
  139. <template #selectionbox>
  140. <view style="height: auto;color: #080808;" @click="commanderDropdownShow = !commanderDropdownShow">
  141. <text>类型∨</text>
  142. <text style="margin-left: 10upx;;font-size: 26upx;">{{ commanderDropdownName || '' }}</text>
  143. </view>
  144. </template>
  145. <template #dropdownbox>
  146. <view style="width: fit-content;box-sizing: border-box;">
  147. <tui-list-view
  148. title="" color="#777" margin-top="2rpx"
  149. style="width: fit-content;min-width: 150upx;max-height: 28vh;overflow-y: auto;"
  150. >
  151. <tui-list-cell
  152. padding="20rpx 0"
  153. style="width: fit-content;margin: 0 auto;border-bottom: 2upx solid #cccccc;"
  154. @click="((franchiseeCommanderInfo.query.type = 6) && (commanderDropdownName = '今日收益') && (commanderDropdownShow = false)) || getFranchiseeCommanderList()"
  155. >
  156. 今日收益
  157. </tui-list-cell>
  158. <tui-list-cell
  159. padding="20rpx 0"
  160. style="width: fit-content;margin: 0 auto;border-bottom: 2upx solid #cccccc;"
  161. @click="((franchiseeCommanderInfo.query.type = 7) && (commanderDropdownName = '预计收益') && (commanderDropdownShow = false)) || getFranchiseeCommanderList()"
  162. >
  163. 预计收益
  164. </tui-list-cell>
  165. <tui-list-cell
  166. padding="20rpx 0"
  167. style="width: fit-content;margin: 0 auto;border-bottom: 2upx solid #cccccc;"
  168. @click="((franchiseeCommanderInfo.query.type = 8) && (commanderDropdownName = '累计收益') && (commanderDropdownShow = false)) || getFranchiseeCommanderList()"
  169. >
  170. 累计收益
  171. </tui-list-cell>
  172. </tui-list-view>
  173. </view>
  174. </template>
  175. </tui-dropdown-list>
  176. </view>
  177. <tui-list-view v-if="franchiseeCommanderInfo.data && franchiseeCommanderInfo.data.length" margin-top="20upx" title="">
  178. <tui-list-cell v-for="(item, index) in franchiseeCommanderInfo.data" :key="item.id">
  179. <view style="display: flex;align-items: center;">
  180. <JAvatar :src="common.seamingImgUrl(item.headImage)" :size="80" style="margin: 0 24upx 0 0;line-height: 1;"></JAvatar>
  181. <view style="flex: 1;">
  182. <view style="display: flex;justify-content: space-between;">
  183. <view>{{ item.name }}</view>
  184. <view>{{ item.createTime || '--' }}</view>
  185. </view>
  186. <view>
  187. 会员等级:{{ item.levelName || '--' }}
  188. </view>
  189. </view>
  190. </view>
  191. </tui-list-cell>
  192. </tui-list-view>
  193. <view style="padding-bottom: 45upx;">
  194. <LoadingMore
  195. :status="!franchiseeCommanderInfo.isEmpty && !franchiseeCommanderInfo.data.length
  196. ? 'loading' : !franchiseeCommanderInfo.isEmpty && franchiseeCommanderInfo.data.length && (franchiseeCommanderInfo.data.length >= franchiseeCommanderInfo.listTotal) ? 'no-more' : ''"
  197. >
  198. </LoadingMore>
  199. <tui-no-data
  200. v-if="franchiseeCommanderInfo.isEmpty" :fixed="false"
  201. style="margin-top: 60upx;"
  202. >
  203. 暂无提问内容
  204. </tui-no-data>
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. </template>
  210. <script>
  211. import { getPlatformFranchiseeStatisticsApi, getFranchiseeShopListApi, getFranchiseeCommanderListApi } from '../../../api/anotherTFInterface'
  212. export default {
  213. name: 'FranchiseeStatistics',
  214. components: {},
  215. data() {
  216. return {
  217. franchiseeStatisticsData: {
  218. shopNum: 0,
  219. TZTodayNum: 0,
  220. TZAccumulateNum: 0,
  221. HHTodayNum: 0,
  222. HHAccumulateNum: 0,
  223. todayIncome: 0,
  224. wayIncome: 0,
  225. accumulateIncome: 0
  226. },
  227. currentTab: 0,
  228. shopDropdownShow: false,
  229. shopDropdownName: '今日收益',
  230. franchiseeShopInfo: {
  231. query: {
  232. page: 1,
  233. pageSize: 10,
  234. type: 6
  235. },
  236. data: [],
  237. listTotal: 0,
  238. isEmpty: false
  239. },
  240. commanderDropdownShow: false,
  241. commanderDropdownName: '今日收益',
  242. franchiseeCommanderInfo: {
  243. query: {
  244. page: 1,
  245. pageSize: 10,
  246. type: 6
  247. },
  248. data: [],
  249. listTotal: 0,
  250. isEmpty: false
  251. }
  252. }
  253. },
  254. onLoad() {
  255. this.getShopStatistics()
  256. this.getFranchiseeShopList()
  257. },
  258. methods: {
  259. getShopStatistics() {
  260. uni.showLoading({
  261. title: '加载中'
  262. })
  263. getPlatformFranchiseeStatisticsApi({})
  264. .then((res) => {
  265. this.franchiseeStatisticsData = res.data
  266. uni.hideLoading()
  267. })
  268. .catch(() => {
  269. uni.hideLoading()
  270. })
  271. },
  272. handleCurrentChange(e) {
  273. this.currentTab = e.index
  274. // 缓存每个tab里的数据
  275. if (this.currentTab === 0) {
  276. } else if (this.currentTab === 1) {
  277. if (!this.franchiseeCommanderInfo.isEmpty && !this.franchiseeCommanderInfo.data.length) this.getFranchiseeCommanderList()
  278. }
  279. // 每点一个tab就重新进行对它的请求
  280. // if (this.currentTab === 0) {
  281. // this.franchiseeShopInfo.query.page = 1
  282. // this.franchiseeShopInfo.data = []
  283. // this.franchiseeShopInfo.listTotal = 0
  284. // this.franchiseeShopInfo.isEmpty = false
  285. // this.getApplyByStoreList()
  286. // } else if (this.currentTab === 1) {
  287. // this.franchiseeCommanderInfo.query.page = 1
  288. // this.franchiseeCommanderInfo.data = []
  289. // this.franchiseeCommanderInfo.listTotal = 0
  290. // this.franchiseeCommanderInfo.isEmpty = false
  291. // this.getApplyByUserList()
  292. // }
  293. },
  294. getFranchiseeShopList(isLoadmore) {
  295. uni.showLoading({
  296. title: '加载中'
  297. })
  298. getFranchiseeShopListApi({ ...this.franchiseeShopInfo.query })
  299. .then((res) => {
  300. this.franchiseeShopInfo.listTotal = res.data.total
  301. if (isLoadmore) {
  302. this.franchiseeShopInfo.data.push(...res.data.records)
  303. } else {
  304. this.franchiseeShopInfo.data = res.data.records
  305. }
  306. this.franchiseeShopInfo.isEmpty = this.franchiseeShopInfo.data.length === 0
  307. uni.hideLoading()
  308. })
  309. .catch(() => {
  310. uni.hideLoading()
  311. })
  312. },
  313. getFranchiseeCommanderList(isLoadmore) {
  314. uni.showLoading({
  315. title: '加载中'
  316. })
  317. getFranchiseeCommanderListApi({ ...this.franchiseeCommanderInfo.query })
  318. .then((res) => {
  319. this.franchiseeCommanderInfo.listTotal = res.data.total
  320. if (isLoadmore) {
  321. this.franchiseeCommanderInfo.data.push(...res.data.records)
  322. } else {
  323. this.franchiseeCommanderInfo.data = res.data.records
  324. }
  325. this.franchiseeCommanderInfo.isEmpty = this.franchiseeCommanderInfo.data.length === 0
  326. uni.hideLoading()
  327. })
  328. .catch(() => {
  329. uni.hideLoading()
  330. })
  331. }
  332. },
  333. onReachBottom() {
  334. if (this.currentTab === 0) {
  335. if (this.franchiseeShopInfo.data.length < this.franchiseeShopInfo.listTotal) {
  336. ++this.franchiseeShopInfo.query.page
  337. this.getFranchiseeShopList(true)
  338. }
  339. } else if (this.currentTab === 1) {
  340. if (this.franchiseeCommanderInfo.data.length < this.franchiseeCommanderInfo.listTotal) {
  341. ++this.franchiseeCommanderInfo.query.page
  342. this.getFranchiseeCommanderList(true)
  343. }
  344. }
  345. }
  346. }
  347. </script>
  348. <style lang="less" scoped>
  349. .finance-statistics-container {
  350. min-height: 100vh;
  351. width: 100%;
  352. background-color: #f6f6f6;
  353. .tui-tabs-view {
  354. /deep/ .tui-tabs-slider {
  355. margin-left: -24upx;
  356. }
  357. }
  358. /deep/ .tui-dropdown-view {
  359. height: auto !important;
  360. width: fit-content;
  361. margin-left: 48upx;
  362. }
  363. }
  364. </style>