myCommission.vue 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="my_commission_wrap">
  3. <view class="queryParams_wrap">
  4. <view class="search">
  5. <u--input clearable prefixIcon="search" v-model="queryParams.phone" shape="circle" clearable
  6. @blur="handleKeyword" @clear="handleKeywordClear" placeholder="请输入电话"></u--input>
  7. </view>
  8. <view class="query">
  9. <view style="margin-right: 10rpx;" @click="handleshowFilter">筛选</view>
  10. <u-icon name="arrow-down-fill" color="#aaa" size="10"></u-icon>
  11. </view>
  12. </view>
  13. <view class="commission_item_wrap">
  14. <!-- 统计信息 -->
  15. <view class="commission_item" v-for="item in listData" :key="item.id">
  16. <view class="commission_top">
  17. <view class="top_left">{{item.item}}</view>
  18. <view class="top_right">
  19. <text class="account_type">{{ item.accountType === '1' ? '前端' : '后端' }}</text>
  20. </view>
  21. </view>
  22. <view class="commission_info">
  23. <view class="info_row">
  24. <view class="info_item">
  25. <text class="label">电话: </text>
  26. <show-real-text :real="item.phone" :type='type'></show-real-text>
  27. </view>
  28. </view>
  29. <view class="info_row">
  30. <view class="info_item">
  31. <text class="label">收单时间: </text>
  32. <text class="value">{{item.receiptDate || '-'}}</text>
  33. </view>
  34. </view>
  35. <view class="info_row">
  36. <view class="info_item">
  37. <text class="label">收单人: </text>
  38. <text class="value">{{item.receiptNickName || '-'}}</text>
  39. </view>
  40. <view class="info_item">
  41. <text class="label">公司: </text>
  42. <text class="value">{{item.orgName || '-'}}</text>
  43. </view>
  44. </view>
  45. <view class="info_row">
  46. <view class="info_item">
  47. <text class="label">分成所属人: </text>
  48. <text class="value">{{item.userName || '-'}}</text>
  49. </view>
  50. <view class="info_item">
  51. <text class="label">分成比例: </text>
  52. <text class="value">{{item.commissionRate || '-'}}%</text>
  53. </view>
  54. </view>
  55. </view>
  56. <view class="commission_amount">
  57. <view class="amount_item">
  58. <view class="amount_label">业绩</view>
  59. <view class="amount_value primary">{{formatAmount(item.commissionAmount)}}</view>
  60. </view>
  61. <view class="amount_item">
  62. <view class="amount_label">毛业绩</view>
  63. <view class="amount_value">{{formatAmount(item.grossAmount)}}</view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. <filter-query ref="filter" v-model="queryParams" @getList="resetData" :mapHeight="mapHeight"></filter-query>
  69. <!-- 加载更多 -->
  70. <u-loadmore :status="loadStatus" v-if="listData.length > 0" />
  71. <!-- 空状态 -->
  72. <show-emtry v-if="listData.length === 0"></show-emtry>
  73. </view>
  74. </template>
  75. <script>
  76. import pullUpRefresh from "@/utils/pullUpRefresh";
  77. import filterQuery from "./filterQuery.vue";
  78. import dayjs from "dayjs";
  79. export default {
  80. mixins: [pullUpRefresh],
  81. components: {
  82. filterQuery,
  83. },
  84. props: {
  85. type: {
  86. type: String,
  87. default: '2'
  88. },
  89. showStats: {
  90. type: Boolean,
  91. default: true
  92. }
  93. },
  94. data() {
  95. return {
  96. queryParams: {
  97. receiptDateEnd: dayjs().format("YYYY-MM-DD"),
  98. receiptDateStart: dayjs().startOf('month').format("YYYY-MM-DD"),
  99. item: undefined,
  100. phone: undefined,
  101. receiptUserId: undefined,
  102. pageNum: 1,
  103. pageSize: 10,
  104. },
  105. mapHeight: "0px"
  106. }
  107. },
  108. methods: {
  109. handleKeyword() {
  110. this.resetData();
  111. },
  112. handleKeywordClear() {
  113. // 组件有bug 清空后的值还是存在
  114. this.queryParams.phone = "";
  115. this.resetData();
  116. },
  117. handleshowFilter() {
  118. this.$refs.filter.show();
  119. },
  120. formatAmount(amount) {
  121. if (!amount) return '-';
  122. return parseFloat(amount).toLocaleString();
  123. },
  124. async getList() {
  125. const {
  126. pageNum,
  127. pageSize,
  128. } = this.queryParams;
  129. this.queryParams.type = this.type;
  130. // 调用分成接口
  131. const {
  132. rows,
  133. total
  134. } = await uni.$u.api.selectCommissionList({
  135. pageSize,
  136. pageNum,
  137. }, this.queryParams);
  138. return rows;
  139. },
  140. handleOnReachBottom() {
  141. this.handleReachBottom();
  142. }
  143. },
  144. mounted() {
  145. this.resetData();
  146. uni.getSystemInfo({
  147. success: (e) => {
  148. const {
  149. windowTop,
  150. windowBottom,
  151. windowHeight
  152. } = e;
  153. this.mapHeight = windowHeight + 'px';
  154. }
  155. });
  156. }
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .my_commission_wrap {
  161. .queryParams_wrap {
  162. display: flex;
  163. background: #fff;
  164. padding: 14px 0;
  165. .query,
  166. .search {
  167. display: flex;
  168. align-items: center;
  169. justify-content: center;
  170. font-size: 16px;
  171. font-weight: 700;
  172. color: #202020;
  173. }
  174. .query {
  175. flex: 1;
  176. }
  177. .search {
  178. flex: 2;
  179. padding-left: 20px;
  180. }
  181. }
  182. }
  183. .stats_info_wrap {
  184. margin-bottom: 30px;
  185. }
  186. .stats_info_top {
  187. display: flex;
  188. margin-bottom: 20px;
  189. .info_item {
  190. box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  191. width: 23%;
  192. margin-right: 2.6%;
  193. height: 120px;
  194. padding: 15px;
  195. background: #fff;
  196. border-radius: 15px;
  197. &:last-child {
  198. margin-right: 0;
  199. }
  200. .info_title {
  201. font-size: 14px;
  202. color: #6b7280;
  203. margin-bottom: 15px;
  204. }
  205. .info_value {
  206. font-size: 24px;
  207. font-weight: bold;
  208. color: #202020;
  209. }
  210. }
  211. }
  212. .commission_item_wrap {
  213. padding: 20px 20px;
  214. }
  215. .commission_item {
  216. background: #fff;
  217. border-radius: 20px;
  218. padding: 20px;
  219. margin-bottom: 20px;
  220. box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  221. .commission_top {
  222. display: flex;
  223. justify-content: space-between;
  224. margin-bottom: 15px;
  225. .top_left {
  226. font-size: 18px;
  227. font-weight: bold;
  228. color: #202020;
  229. }
  230. .top_right {
  231. .account_type {
  232. background: #108cff;
  233. color: #fff;
  234. padding: 4px 8px;
  235. border-radius: 10px;
  236. font-size: 12px;
  237. }
  238. }
  239. }
  240. .commission_info {
  241. margin-bottom: 15px;
  242. .info_row {
  243. display: flex;
  244. margin-bottom: 8px;
  245. &:last-child {
  246. margin-bottom: 0;
  247. }
  248. .info_item {
  249. flex: 1;
  250. display: flex;
  251. align-items: center;
  252. font-size: 14px;
  253. .label {
  254. color: #9b9aa2;
  255. margin-right: 8px;
  256. min-width: 60px;
  257. }
  258. .value {
  259. color: #202020;
  260. }
  261. }
  262. }
  263. }
  264. .commission_amount {
  265. display: flex;
  266. justify-content: space-around;
  267. padding: 15px 0;
  268. border-top: 1px solid #f0f0f0;
  269. background: #f8f9fb;
  270. border-radius: 10px;
  271. .amount_item {
  272. text-align: center;
  273. .amount_label {
  274. font-size: 12px;
  275. color: #9b9aa2;
  276. margin-bottom: 5px;
  277. }
  278. .amount_value {
  279. font-size: 16px;
  280. font-weight: bold;
  281. color: #202020;
  282. &.primary {
  283. color: #108cff;
  284. }
  285. }
  286. }
  287. }
  288. }
  289. .empty_wrap {
  290. margin-top: 100px;
  291. }
  292. </style>