balance.vue 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. <template>
  2. <app-layout>
  3. <view class="no-list" v-if="list.length == 0">
  4. <image src="/static/image/order-empty.png"></image>
  5. <view>暂无任何明细</view>
  6. </view>
  7. <view v-else>
  8. <view v-for="(item, key) in list" :key="key" class="balance-item">
  9. <view class="balance-date">
  10. <text class="balance-type" v-if="item.bonus_type == 1">按周 </text>
  11. <text class="balance-type" v-else>按月 </text>
  12. <text>{{item.start_time}} - {{item.end_time}}</text>
  13. </view>
  14. <view class="balance-info">
  15. <view class="level corss-center">{{item.level_name}}</view>
  16. <view>订单数 {{item.order_num}}<text class="order-price">{{setting.form.rate_text ? setting.form.rate_text : '分红比例'}} {{item.bonus_rate}}%</text></view>
  17. <view class="bonus-info dir-top-nowrap main-center">
  18. <view>{{setting.form.price_text ? setting.form.price_text : '分红金额'}}</view>
  19. <view class="bonus-price">¥{{item.price}}</view>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </app-layout>
  25. </template>
  26. <script>
  27. import { mapState } from "vuex";
  28. export default {
  29. data() {
  30. return {
  31. setting: {},
  32. list: [],
  33. more: false,
  34. page: 1
  35. }
  36. },
  37. computed: {
  38. ...mapState({
  39. })
  40. },
  41. methods: {
  42. getSetting() {
  43. let that = this;
  44. uni.showLoading({
  45. mask: true,
  46. title: '加载中...'
  47. });
  48. that.$request({
  49. url: that.$api.stock.setting,
  50. }).then(response=>{
  51. if(response.code == 0) {
  52. that.setting = response.data;
  53. that.getList();
  54. }else {
  55. uni.showToast({
  56. title: response.msg,
  57. icon: 'none',
  58. duration: 1000
  59. });
  60. }
  61. }).catch(response => {
  62. uni.hideLoading();
  63. });
  64. },
  65. getList() {
  66. let that = this;
  67. that.$request({
  68. url: that.$api.stock.bonus,
  69. }).then(response=>{
  70. uni.hideLoading();
  71. if(response.code == 0) {
  72. that.list = response.data.list;
  73. if(response.data.list.length == response.data.pagination.pageSize) {
  74. this.more = true;
  75. this.page++;
  76. }
  77. }else {
  78. uni.showToast({
  79. title: response.msg,
  80. icon: 'none',
  81. duration: 1000
  82. });
  83. }
  84. }).catch(response => {
  85. uni.hideLoading();
  86. });
  87. },
  88. getMore() {
  89. let that = this;
  90. that.more = false;
  91. uni.showLoading({
  92. mask: true,
  93. title: '加载更多...'
  94. });
  95. that.$request({
  96. url: that.$api.stock.bonus,
  97. data: {
  98. page: that.page
  99. }
  100. }).then(response=>{
  101. uni.hideLoading();
  102. if(response.code == 0) {
  103. that.list = that.list.concat(response.data.list);
  104. if(response.data.list.length == response.data.pagination.pageSize) {
  105. that.more = true;
  106. that.page++;
  107. }
  108. }else {
  109. uni.showToast({
  110. title: response.msg,
  111. icon: 'none',
  112. duration: 1000
  113. });
  114. }
  115. }).catch(response => {
  116. uni.hideLoading();
  117. });
  118. }
  119. },
  120. onLoad(options) { this.$commonLoad.onload(options);
  121. if(options.name) {
  122. uni.setNavigationBarTitle({
  123. title: options.name,
  124. })
  125. }
  126. this.getSetting();
  127. },
  128. onReachBottom() {
  129. if(this.more) {
  130. this.getMore();
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. .no-list {
  137. text-align: center;
  138. margin-top: #{200rpx};
  139. font-size: #{24rpx};
  140. color: #666666;
  141. image {
  142. width: #{240rpx};
  143. height: #{240rpx};
  144. margin-bottom: #{20rpx};
  145. }
  146. }
  147. .balance-item {
  148. background-color: #fff;
  149. border-radius: #{8rpx};
  150. font-size: #{28rpx};
  151. color: #999999;
  152. margin: #{24rpx} #{24rpx} #{12rpx};
  153. width: #{702rpx};
  154. box-shadow: 0 0 #{20rpx} rgba(0,0,0,0.1);
  155. .balance-date {
  156. padding: 0 #{32rpx};
  157. height: #{96rpx};
  158. line-height: #{96rpx};
  159. .balance-type {
  160. margin-right: #{10rpx};
  161. }
  162. }
  163. .balance-info {
  164. border-top: #{2rpx} solid #e2e2e2;
  165. height: #{162rpx};
  166. padding: #{32rpx} #{32rpx};
  167. position: relative;
  168. .level {
  169. font-size: #{32rpx};
  170. color: #353535;
  171. margin-bottom: #{16rpx};
  172. text {
  173. font-size: #{24rpx};
  174. color: #ff4544;
  175. margin-left: #{20rpx};
  176. }
  177. }
  178. .bonus-info {
  179. height: #{162rpx};
  180. font-size: #{26rpx};
  181. color: #353535;
  182. text-align: right;
  183. position: absolute;
  184. bottom: 0;
  185. right: #{32rpx};
  186. .bonus-price {
  187. font-size: #{38rpx};
  188. color: #ff4544;
  189. font-family: DIN;
  190. }
  191. }
  192. .order-price {
  193. margin-left: #{40rpx};
  194. }
  195. }
  196. }
  197. </style>