index.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <template>
  2. <view>
  3. <view class="promoter-order">
  4. <view class='promoterHeader bg-color'>
  5. <view class='headerCon acea-row row-between-wrapper'>
  6. <view>
  7. <view class='name'>累积推广订单</view>
  8. <view><text class='num'>{{recordCount || 0}}</text>单</view>
  9. </view>
  10. <view class='iconfont icon-2'></view>
  11. </view>
  12. </view>
  13. <view class='list pad30' v-if="recordList.length>0">
  14. <block v-for="(item,index) in recordList" :key="index">
  15. <view class='item'>
  16. <view class='title acea-row row-column row-center'>
  17. <view class='data'>{{item.time}}</view>
  18. <view>本月累计推广订单:{{item.count || 0}}单</view>
  19. </view>
  20. <view class='listn'>
  21. <block v-for="(child,indexn) in item.child" :key="indexn">
  22. <view class='itenm borRadius14'>
  23. <view class='top acea-row row-between-wrapper'>
  24. <view class='pictxt acea-row row-between-wrapper'>
  25. <view class='pictrue'>
  26. <image :src='child.avatar'></image>
  27. </view>
  28. <view class='text line1'>{{child.nickname}}</view>
  29. </view>
  30. <view class='money'>返佣:<text class='font-color'>¥{{child.number}}</text></view>
  31. <!-- <view class='money' v-if="child.type == 'brokerage'">返佣:<text class='font-color'>¥{{child.number}}</text></view>
  32. <view class='money' v-else>暂未返佣:<text class='font-color'>¥{{child.number}}</text></view> -->
  33. </view>
  34. <view class='bottom'>
  35. <view><text class='name'>订单编号:</text>{{child.orderId}}</view>
  36. <view><text class='name'>下单时间:</text>{{child.time}}</view>
  37. </view>
  38. </view>
  39. </block>
  40. </view>
  41. </view>
  42. </block>
  43. </view>
  44. <view v-if="recordList.length == 0">
  45. <emptyPage title="暂无推广订单~"></emptyPage>
  46. </view>
  47. </view>
  48. <!-- #ifdef MP -->
  49. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  50. <!-- #endif -->
  51. <home></home>
  52. </view>
  53. </template>
  54. <script>
  55. import {
  56. spreadOrder
  57. } from '@/api/user.js';
  58. import {
  59. toLogin
  60. } from '@/libs/login.js';
  61. import {
  62. mapGetters
  63. } from "vuex";
  64. // #ifdef MP
  65. import authorize from '@/components/Authorize';
  66. // #endif
  67. import emptyPage from '@/components/emptyPage.vue'
  68. import home from '@/components/home';
  69. export default {
  70. components: {
  71. // #ifdef MP
  72. authorize,
  73. // #endif
  74. emptyPage,
  75. home
  76. },
  77. data() {
  78. return {
  79. page: 1,
  80. limit: 10,
  81. status: false,
  82. recordList: [],
  83. recordCount: 0,
  84. isAuto: false, //没有授权的不会自动授权
  85. isShowAuth: false,//是否隐藏授权
  86. time: 0
  87. };
  88. },
  89. computed: mapGetters(['isLogin']),
  90. onLoad() {
  91. if (this.isLogin) {
  92. this.getRecordOrderList();
  93. } else {
  94. toLogin();
  95. }
  96. },
  97. methods: {
  98. stringToDate : function(data){
  99. let str = data.replace(/-/g,'/');
  100. let date = new Date(str);
  101. return data;
  102. },
  103. onLoadFun() {
  104. this.getRecordOrderList();
  105. },
  106. // 授权关闭
  107. authColse: function(e) {
  108. this.isShowAuth = e
  109. },
  110. getRecordOrderList: function() {
  111. let that = this;
  112. let page = that.page;
  113. let limit = that.limit;
  114. let status = that.status;
  115. let recordList = that.recordList;
  116. let newList = [];
  117. if (status == true) return;
  118. spreadOrder({
  119. page: page,
  120. limit: limit
  121. }).then(res => {
  122. let recordListData = res.data.list ? res.data.list : [];
  123. // 每页返回的总条数;
  124. let len = 0;
  125. for(let i = 0;i<recordListData.length;i++) {
  126. len = len + recordListData[i].child.length;
  127. let str = recordListData[i].time.replace(/-/g,'/');
  128. let date = new Date(str).getTime();
  129. if(that.time === date){
  130. that.$set(that.recordList[i],'child',that.recordList[i].child.concat(recordListData[i].child));
  131. }else{
  132. recordListData.forEach((item,index)=>{
  133. if(recordListData[i]==item){
  134. newList.push(item);
  135. }
  136. })
  137. that.$set(that, 'recordList', recordList.concat(newList));
  138. }
  139. that.time = date;
  140. };
  141. that.recordCount = res.data.count || 0;
  142. that.status = limit > len;
  143. that.page = page + 1;
  144. });
  145. }
  146. },
  147. onReachBottom() {
  148. this.getRecordOrderList()
  149. }
  150. }
  151. </script>
  152. <style scoped lang="scss">
  153. .promoter-order .list .item .title {
  154. height: 133rpx;
  155. font-size: 26rpx;
  156. color: #999;
  157. }
  158. .promoter-order .list .item .title .data {
  159. font-size: 28rpx;
  160. color: #282828;
  161. margin-bottom: 5rpx;
  162. }
  163. .promoter-order .list .item .listn .itenm {
  164. background-color: #fff;
  165. }
  166. .promoter-order .list .item .listn .itenm~.itenm {
  167. margin-top: 20rpx;
  168. }
  169. .promoter-order .list .item .listn .itenm .top {
  170. padding: 0 24rpx;
  171. border-bottom: 1rpx solid #eee;
  172. height: 100rpx;
  173. }
  174. .promoter-order .list .item .listn .itenm .top .pictxt {
  175. width: 320rpx;
  176. }
  177. .promoter-order .list .item .listn .itenm .top .pictxt .text {
  178. width: 230rpx;
  179. font-size: 30rpx;
  180. color: #282828;
  181. }
  182. .promoter-order .list .item .listn .itenm .top .pictxt .pictrue {
  183. width: 66rpx;
  184. height: 66rpx;
  185. }
  186. .promoter-order .list .item .listn .itenm .top .pictxt .pictrue image {
  187. width: 100%;
  188. height: 100%;
  189. border-radius: 50%;
  190. border: 3rpx solid #fff;
  191. box-sizing: border-box;
  192. box-shadow: 0 0 15rpx #aaa;
  193. }
  194. .promoter-order .list .item .listn .itenm .top .money {
  195. font-size: 28rpx;
  196. }
  197. .promoter-order .list .item .listn .itenm .bottom {
  198. padding: 20rpx 24rpx;
  199. font-size: 28rpx;
  200. color: #666;
  201. line-height: 1.6;
  202. }
  203. .promoter-order .list .item .listn .itenm .bottom .name {
  204. color: #999;
  205. }
  206. </style>