commission.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <view class="page">
  3. <!-- 经纪人信息卡片 -->
  4. <view class="userinfo-wrap box-shadow">
  5. <!-- 个人信息 -->
  6. <view class="userinfo">
  7. <view class="user">
  8. <u-avatar
  9. class="u-skeleton-circle box-shadow"
  10. :src="vk.vuex.get('$user.userInfo.avatar')"
  11. size="120"
  12. :show-level="vk.checkToken() && vk.vuex.get('$user.agentInfo.verify_status') == 1"
  13. @click="vk.checkToken() ? vk.navigateTo('/pages/user/setting/avatar') : vk.toast('登录后可设置头像')"
  14. ></u-avatar>
  15. <view class="info">
  16. <view class="nickname u-skeleton-rect">
  17. {{
  18. vk.checkToken()
  19. ? vk.vuex.get('$user.agentInfo.relname')
  20. ? vk.vuex.get('$user.agentInfo.relname')
  21. : vk.vuex.get('$user.userInfo.username')
  22. : '未登录'
  23. }}
  24. </view>
  25. <u-tag
  26. class="u-m-r-10"
  27. v-if="vk.checkToken() && vk.pubfn.isNotNull(vk.vuex.get('$user.agentInfo.type'))"
  28. size="mini"
  29. type="primary"
  30. :text="agentTypeList[vk.vuex.get('$user.agentInfo.type')]"
  31. ></u-tag>
  32. <u-tag v-if="vk.vuex.get('$user.agentInfo.verify_status') == 1" size="mini" type="success" text="已认证"></u-tag>
  33. <view v-else class="mobile u-skeleton-rect">登录后开始推荐赚佣</view>
  34. </view>
  35. </view>
  36. <view class="commission-num">
  37. <view class="main-title"><u-count-to bold :start-val="0" :end-val="vk.vuex.get('$user.dataInfo.totalCommission')"></u-count-to></view>
  38. <view class="sub-title">元</view>
  39. </view>
  40. </view>
  41. </view>
  42. <view v-show="dataList.length == 0" class="empty-wrap"><u-empty text="暂无佣金记录"></u-empty></view>
  43. <!-- 记录 -->
  44. <u-cell-group class="box-shadow" v-show="dataList.length > 0">
  45. <u-cell-item
  46. v-for="(item, index) in dataList"
  47. :key="index"
  48. :title="item.customerInfo.name + '(' + item.customerInfo.mobile + ')'"
  49. :label="item.propertyInfo.name + ' / ' + item.amount + '元 / ' + vk.pubfn.timeFormat(item._add_time, 'yyyy-MM-dd')"
  50. value="查看详情"
  51. arrow
  52. @click="showDetailPopup(index)"
  53. ></u-cell-item>
  54. </u-cell-group>
  55. <!-- 消息详情 -->
  56. <!-- <u-popup v-model="detailPopupShow" mode="center" width="80%" height="480rpx" border-radius="20" closeable close-icon-color="#fff">
  57. <view class="bwin-popup">
  58. <view class="popup-header">消息详情</view>
  59. <view v-if="detailPopupShow" class="popup-body">
  60. <text class="content" v-if="dataList[currentItemIndex].type == 'text'">{{ dataList[currentItemIndex].body.content }}</text>
  61. <u-image v-if="dataList[currentItemIndex].type == 'image'" :src="dataList[currentItemIndex].body.files" mode="widthFix" width="100%"></u-image>
  62. <view class="from-info">
  63. <view class="nickname">{{ dataList[currentItemIndex].fromUserInfo.nickname }}</view>
  64. <view class="date">{{ dataList[currentItemIndex]._add_time | date('yyyy-mm-dd hh:MM:ss') }}</view>
  65. </view>
  66. </view>
  67. </view>
  68. </u-popup> -->
  69. <u-loadmore
  70. v-if="dataList.length > 0"
  71. marginTop="20"
  72. :line="true"
  73. :status="loadmore.status"
  74. :loading-text="loadmore.loadingText"
  75. :loadmore-text="loadmore.defaultText"
  76. :nomore-text="loadmore.nomoreText"
  77. />
  78. </view>
  79. </template>
  80. <script>
  81. var that;
  82. export default {
  83. data() {
  84. return {
  85. agentTypeList: ['', '自由经纪人', '渠道经纪人', '老业主'],
  86. dataList: [],
  87. detailPopupShow: false,
  88. currentItemIndex: 0,
  89. loadmore: {
  90. status: 'loadmore',
  91. loadingText: '努力加载中',
  92. defaultText: '轻轻上拉 查看更多',
  93. nomoreText: '实在没有了',
  94. currentPage: 1
  95. }
  96. };
  97. },
  98. onLoad() {
  99. that = this;
  100. vk.callFunction({
  101. url: 'client/agent/kh/getCommissionList',
  102. title: '请求中...',
  103. data: {
  104. agentId: vk.vuex.get('$user.agentInfo._id')
  105. },
  106. needAlert: false
  107. }).then(res => {
  108. if (res.list.length < 10) {
  109. that.loadmore.status = 'nomore';
  110. }
  111. that.dataList = res.list;
  112. vk.vuex.set('$user.dataInfo.totalCommission', res.totalCommission);
  113. });
  114. },
  115. onReachBottom() {
  116. if (that.loadmore.status == 'nomore') {
  117. return;
  118. }
  119. that.loadmore.currentPage++;
  120. vk.callFunction({
  121. url: 'client/agent/kh/getCommissionList',
  122. title: '请求中...',
  123. needAlert: false,
  124. data: {
  125. pageIndex: that.loadmore.currentPage,
  126. agentId: vk.vuex.get('$user.agentInfo._id')
  127. }
  128. }).then(res => {
  129. if (res.list.length < 10) {
  130. that.loadmore.status = 'nomore';
  131. }
  132. that.dataList = that.dataList.concat(res.list);
  133. });
  134. },
  135. methods: {
  136. showDetailPopup(index) {
  137. that.currentItemIndex = index;
  138. that.detailPopupShow = true;
  139. }
  140. }
  141. };
  142. </script>
  143. <style lang="scss">
  144. .page {
  145. min-height: calc(100vh - 44px);
  146. }
  147. .userinfo-wrap {
  148. display: flex;
  149. flex-direction: column;
  150. align-items: flex-start;
  151. background-color: #fff;
  152. padding: 32rpx;
  153. width: 100%;
  154. margin-bottom: 20rpx;
  155. border-radius: 10rpx;
  156. position: relative;
  157. .userinfo {
  158. width: 100%;
  159. display: flex;
  160. align-items: center;
  161. justify-content: space-between;
  162. .user {
  163. display: flex;
  164. align-items: center;
  165. .info {
  166. margin-left: 32rpx;
  167. .nickname {
  168. font-size: $u-p;
  169. font-weight: bold;
  170. color: $u-main-color;
  171. margin-bottom: 5rpx;
  172. }
  173. .mobile {
  174. font-size: $u-p1;
  175. color: $u-tips-color;
  176. }
  177. }
  178. }
  179. }
  180. .commission-num {
  181. display: flex;
  182. align-items: flex-end;
  183. .main-title {
  184. font-size: $u-h1;
  185. font-weight: bold;
  186. line-height: $u-h2;
  187. margin-right: 10rpx;
  188. }
  189. .sub-title {
  190. font-size: $u-p2;
  191. }
  192. }
  193. }
  194. .popup-body {
  195. .content {
  196. font-size: $u-p;
  197. display: flex;
  198. padding: 20rpx;
  199. background-color: $u-bg-color;
  200. border-radius: 10rpx;
  201. width: 100%;
  202. }
  203. .from-info {
  204. padding-top: 20rpx;
  205. width: 100%;
  206. display: flex;
  207. align-items: center;
  208. justify-content: space-between;
  209. font-size: $u-p1;
  210. .nickname {
  211. color: $u-main-color;
  212. }
  213. .date {
  214. color: $u-content-color;
  215. }
  216. }
  217. }
  218. </style>