commission.vue 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332
  1. <template>
  2. <view class="content">
  3. <view class="content-money">
  4. <!-- 提现 -->
  5. <view class="withdraw"><text class="withdraw-text" @click="ToTixan">提现</text></view>
  6. <view class="money-box">
  7. <view class="money_name">我的余额(元)</view>
  8. <view class="money_name money_num">{{ money || 0.0 }}</view>
  9. </view>
  10. <view class="flex buttom-box">
  11. <view class="buttom">
  12. <view class="money">{{ extracted || 0.0 }}</view>
  13. <text class="text">已结算(元)</text>
  14. </view>
  15. <view class="interval"></view>
  16. <view class="buttom">
  17. <view class="money">{{ extracting || 0.0 }}</view>
  18. <text class="text">待结算(元)</text>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="swiper-box">
  23. <scroll-view class="list-scroll-content" scroll-y @scrolltolower="commission">
  24. <!-- <view class="nodata" v-if="list.length == 0"><view class="text">暂时没有数据哦!</view></view> -->
  25. <view v-for="(item, index) in list" class="list-box">
  26. <view class="list-left">
  27. <view class="list-name">{{ item.mark }}</view>
  28. <view class="list-time">{{ item.add_time }}</view>
  29. </view><!-- {{ (item.pm == 0 ? '-' : '+') + item.number }} -->
  30. <view class="list-right">
  31. <text class="jian" v-if="item.pm == 1">+{{item.number}}</text>
  32. <text class="jia" v-if="item.pm == 0">-{{item.number}}</text>
  33. </view>
  34. </view>
  35. <uni-load-more :status="loadingType"></uni-load-more>
  36. </scroll-view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import { mapState, mapMutations } from 'vuex';
  42. import { withdraw_info, order_income } from '@/api/wallet.js';
  43. import { getTime } from '@/utils/rocessor.js';
  44. export default {
  45. components: {},
  46. data() {
  47. return {
  48. limit: 10, //每次加载数据条数
  49. page: 1, //当前页数
  50. loadingType: 'more', //加载更多状态
  51. loading: 0, //判断是否为点击搜索按钮跳转加载
  52. money: '', //佣金金额
  53. extracting: '', //待结算佣金金额
  54. extracted: '', //已结算佣金金额
  55. extract_bank: '', //银行卡信息
  56. list: []
  57. };
  58. },
  59. onLoad(options) {
  60. this.loadData();
  61. this.commission();
  62. },
  63. onShow() {},
  64. onPullDownRefresh() {
  65. this.page = 1;
  66. this.commission('refresh');
  67. },
  68. onUnload(){
  69. uni.switchTab({
  70. url: '/pages/user/user'
  71. });
  72. },
  73. methods: {
  74. //获取佣金信息
  75. loadData() {
  76. let obj = this;
  77. withdraw_info({})
  78. .then(({ data }) => {
  79. obj.money = data.brokerage_price;
  80. obj.extracting = data.extracting;
  81. obj.extracted = data.extracted;
  82. obj.extract_bank = JSON.parse(data.extract_bank);
  83. // console.log(obj.extract_bank)
  84. })
  85. .catch(e => {});
  86. },
  87. //获取佣金收支列表
  88. commission(type) {
  89. let obj = this;
  90. //这里是将订单挂载到tab列表下
  91. if (type !== 'refresh') {
  92. //没有更多数据直接跳出方法
  93. if (obj.loadingType === 'nomore') {
  94. return;
  95. } else {
  96. // 设置当前为数据载入中
  97. obj.loadingType = 'loading';
  98. }
  99. } else {
  100. //当重新加载数据时更新状态为可继续添加数据
  101. obj.loadingType = 'more';
  102. }
  103. order_income({
  104. page: obj.page,
  105. limit: obj.limit
  106. })
  107. .then(({ data }) => {
  108. if (type === 'refresh') {
  109. obj.list = [];
  110. }
  111. let arr = data.brokerage_list.map(e => {
  112. e.add_time = getTime(e.add_time);
  113. return e;
  114. });
  115. obj.list = obj.list.concat(arr);
  116. //判断是否还有下一页,有是more 没有是nomore
  117. if (obj.limit == obj.list.length) {
  118. obj.page++;
  119. obj.loadingType = 'more';
  120. } else {
  121. obj.loadingType = 'nomore';
  122. }
  123. // 判断是否为刷新数据
  124. if (type === 'refresh') {
  125. // 判断是否为点击搜索按钮跳转加载
  126. if (obj.loading == 1) {
  127. uni.hideLoading();
  128. } else {
  129. uni.stopPullDownRefresh();
  130. }
  131. }
  132. })
  133. .catch(e => {
  134. console.log(e.message);
  135. });
  136. },
  137. // 页面跳转
  138. ToTixan() {
  139. uni.navigateTo({
  140. url: '/pages/wallet/withdrawal'
  141. });
  142. }
  143. }
  144. };
  145. </script>
  146. <style lang="scss">
  147. page {
  148. height: 100%;
  149. }
  150. .content {
  151. height: 100%;
  152. .swiper-box {
  153. padding-top: 25rpx;
  154. height: calc(100% - 220px);
  155. background-color: #ffffff;
  156. .list-scroll-content {
  157. height: 100%;
  158. }
  159. }
  160. }
  161. .nodata{
  162. width: 100%;
  163. text-align: center;
  164. font-size: 32rpx;
  165. padding-top: 20rpx;
  166. }
  167. .content-money {
  168. padding-bottom: 30rpx;
  169. position: relative;
  170. .buttom-box {
  171. background-color: #ffffff;
  172. text-align: center;
  173. margin: 0 30rpx;
  174. padding: 30rpx 0;
  175. border-radius: $border-radius-sm;
  176. margin-top: -60rpx;
  177. z-index: 100;
  178. .buttom {
  179. font-size: $font-lg;
  180. flex-grow: 1;
  181. .money {
  182. font-weight: 400;
  183. font-size: 32rpx;
  184. color: #333333;
  185. }
  186. }
  187. .text {
  188. color: #666666;
  189. font-size: 26rpx;
  190. font-weight: 400;
  191. }
  192. .interval {
  193. width: 2rpx;
  194. height: 60rpx;
  195. background-color: #eeeeee;
  196. }
  197. .icon {
  198. height: 50rpx;
  199. width: 48rpx;
  200. margin: 0 auto;
  201. .icon-img {
  202. width: 100%;
  203. height: 100%;
  204. }
  205. }
  206. }
  207. }
  208. .money-box {
  209. padding-top: 100rpx;
  210. background: linear-gradient(52deg, rgba(126, 153, 254, 1), rgba(151, 143, 250, 1));
  211. height: 400rpx;
  212. color: #ffffff;
  213. text-align: center;
  214. // 全部
  215. .top {
  216. display: flex;
  217. justify-content: space-between;
  218. padding: 10rpx 25rpx 60rpx;
  219. .top-left {
  220. width: 127rpx;
  221. height: 40rpx;
  222. border: 1rpx solid rgba(255, 255, 255, 1);
  223. border-radius: 20px;
  224. line-height: 40rpx;
  225. .top-left-text {
  226. width: 127rpx;
  227. // height:40rpx;
  228. font-size: $font-sm;
  229. font-weight: 400;
  230. color: rgba(255, 255, 255, 1);
  231. text-align: center;
  232. .top-left-text1 {
  233. margin-right: 5rpx;
  234. }
  235. .iconfont {
  236. // height: 40rpx;
  237. line-height: 100%;
  238. }
  239. }
  240. }
  241. .top-right {
  242. font-size: $font-sm;
  243. font-weight: 400;
  244. color: rgba(255, 255, 255, 1);
  245. display: flex;
  246. align-items: center;
  247. text {
  248. font-size: $font-base + 2rpx;
  249. }
  250. }
  251. }
  252. .money_name {
  253. width: 100%;
  254. text-align: center;
  255. padding-bottom: 25rpx;
  256. font-size: $font-sm + 2rpx;
  257. font-weight: 400;
  258. color: rgba(255, 255, 255, 1);
  259. }
  260. .money_num {
  261. font-size: 60rpx;
  262. font-weight: bold;
  263. color: rgba(255, 255, 255, 1);
  264. }
  265. .forms {
  266. text-decoration: underline;
  267. }
  268. }
  269. // 提现
  270. .withdraw {
  271. position: absolute;
  272. top: 165rpx;
  273. right: 0;
  274. width: 160rpx;
  275. height: 64rpx;
  276. background: rgba(255, 255, 255, 1);
  277. border: 2px solid rgba(255, 255, 255, 1);
  278. border-radius: 32px 0px 0px 32px;
  279. text-align: center;
  280. .withdraw-text {
  281. font-size: $font-base + 2rpx;
  282. font-weight: bold;
  283. color: rgba(130, 152, 253, 1);
  284. line-height: 60rpx;
  285. letter-spacing: 2rpx;
  286. }
  287. }
  288. // 详情
  289. .list-box {
  290. margin: 0 30rpx;
  291. padding: 25rpx 0rpx;
  292. border-bottom: 1px solid #eeeeee;
  293. display: flex;
  294. align-items: center;
  295. justify-content: space-between;
  296. .list-left {
  297. .list-name {
  298. max-width: 400rpx;
  299. font-size: $font-base;
  300. font-weight: 600;
  301. color: rgba(51, 51, 51, 1);
  302. overflow: hidden;
  303. text-overflow: ellipsis;
  304. white-space: nowrap;
  305. }
  306. .list-time {
  307. margin-top: 16rpx;
  308. font-size: $font-sm - 2rpx;
  309. font-weight: 400;
  310. color: rgba(153, 153, 153, 1);
  311. }
  312. }
  313. .list-right {
  314. min-width: 220rpx;
  315. font-size: $font-base + 2rpx;
  316. text-align: right;
  317. letter-spacing: 1px;
  318. font-weight: bold;
  319. .jia{
  320. color: rgba(51, 51, 51, 1);
  321. }
  322. .jian{
  323. color: rgba(252, 42, 63, 1);
  324. }
  325. }
  326. }
  327. </style>