index.vue 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view :style="colorStyle">
  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'>{{count || 0}}</text>单</view>
  9. </view>
  10. <view class='iconfont icon-2'></view>
  11. </view>
  12. </view>
  13. <view class='list' 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'>
  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' v-if="child.type == 'brokerage'">返佣:<text
  31. class='font-color'>¥{{child.number}}</text></view>
  32. <view class='money' v-else>暂未返佣:<text
  33. class='font-color'>¥{{child.number}}</text></view>
  34. </view>
  35. <view class='bottom'>
  36. <view><text class='name'>订单编号:</text>{{child.order_id}}</view>
  37. <view v-if="child.type == 'brokerage'"><text
  38. class='name'>返佣时间:</text>{{child.time}}</view>
  39. <view v-else><text class='name'>下单时间:</text>{{child.time}}</view>
  40. <view class="more" v-if="child.children && child.children.length" @click="open(child)">
  41. {{child.open?"收起":"更多"}}
  42. <text class="iconfont" :class="child.open?'icon-xiangshang':'icon-xiangxia'"></text>
  43. </view>
  44. </view>
  45. <view class="more-record" v-if="child.open">
  46. <view class="more-record-list" v-for="(sp,indexs) in child.children" :key="indexs">
  47. <view class="more-record-box">
  48. <view><text class='name'>单号:</text>{{sp.order_id}}</view>
  49. <view class='money' v-if="sp.type == 'brokerage'">返佣:<text
  50. class='font-color'>¥{{sp.number}}</text></view>
  51. <view class='money' v-else>暂未返佣:<text
  52. class='font-color'>¥{{sp.number}}</text></view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </block>
  58. </view>
  59. </view>
  60. </block>
  61. </view>
  62. <view v-if="recordList.length == 0">
  63. <emptyPage title="暂无推广订单~"></emptyPage>
  64. </view>
  65. </view>
  66. <!-- #ifdef MP -->
  67. <!-- <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
  68. <!-- #endif -->
  69. <!-- #ifndef MP -->
  70. <home></home>
  71. <!-- #endif -->
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. spreadOrder
  77. } from '@/api/user.js';
  78. import {
  79. toLogin
  80. } from '@/libs/login.js';
  81. import {
  82. mapGetters
  83. } from "vuex";
  84. // #ifdef MP
  85. import authorize from '@/components/Authorize';
  86. // #endif
  87. import emptyPage from '@/components/emptyPage.vue'
  88. import home from '@/components/home';
  89. import colors from '@/mixins/color.js';
  90. export default {
  91. components: {
  92. // #ifdef MP
  93. authorize,
  94. // #endif
  95. emptyPage,
  96. home
  97. },
  98. mixins: [colors],
  99. data() {
  100. return {
  101. page: 1,
  102. limit: 5,
  103. status: false,
  104. recordList: [],
  105. times: [],
  106. recordCount: 0,
  107. count: 0,
  108. isAuto: false, //没有授权的不会自动授权
  109. isShowAuth: false //是否隐藏授权
  110. };
  111. },
  112. computed: mapGetters(['isLogin']),
  113. onLoad() {
  114. if (this.isLogin) {
  115. this.getRecordOrderList();
  116. } else {
  117. toLogin();
  118. }
  119. },
  120. methods: {
  121. open(item){
  122. item.open = !item.open
  123. },
  124. onLoadFun() {
  125. this.getRecordOrderList();
  126. },
  127. // 授权关闭
  128. authColse: function(e) {
  129. this.isShowAuth = e
  130. },
  131. getRecordOrderList: function() {
  132. let that = this;
  133. let page = that.page;
  134. let limit = that.limit;
  135. let status = that.status;
  136. if (status == true) return;
  137. spreadOrder({
  138. page: page,
  139. limit: limit
  140. }).then(res => {
  141. for (let i = 0; i < res.data.time.length; i++) {
  142. if (!this.times.includes(res.data.time[i].time)) {
  143. this.times.push(res.data.time[i].time)
  144. this.recordList.push({
  145. time: res.data.time[i].time,
  146. count: res.data.time[i].count,
  147. child: []
  148. })
  149. }
  150. }
  151. console.log(this.recordList, this.times.length)
  152. for (let x = 0; x < this.times.length; x++) {
  153. for (let j = 0; j < res.data.list.length; j++) {
  154. if (this.times[x] === res.data.list[j].time_key) {
  155. res.data.list[j].open = false
  156. this.recordList[x].child.push(res.data.list[j])
  157. }
  158. }
  159. }
  160. console.log(this.recordList)
  161. that.count = res.data.count || 0;
  162. that.status = res.data.list.length < 5;
  163. that.page += 1;
  164. });
  165. }
  166. },
  167. onReachBottom: function() {
  168. this.getRecordOrderList();
  169. }
  170. }
  171. </script>
  172. <style scoped lang="scss">
  173. .promoter-order .list .item .title {
  174. height: 133rpx;
  175. padding: 0 30rpx;
  176. font-size: 26rpx;
  177. color: #999;
  178. }
  179. .promoter-order .list .item .title .data {
  180. font-size: 28rpx;
  181. color: #282828;
  182. margin-bottom: 5rpx;
  183. }
  184. .promoter-order .list .item .listn .itenm {
  185. background-color: #fff;
  186. // margin: 0 $uni-index-margin-row;
  187. border-radius: 8rpx;
  188. .more-record{
  189. color: #999;
  190. font-size: 24rpx;
  191. .more-record-list{
  192. padding: 20rpx 30rpx;
  193. border-top: 1px solid #f2f2f2;
  194. .more-record-box{
  195. display: flex;
  196. justify-content: space-between;
  197. }
  198. }
  199. }
  200. }
  201. .promoter-order .list .item .listn .itenm~.itenm {
  202. margin-top: 12rpx;
  203. }
  204. .promoter-order .list .item .listn .itenm .top {
  205. margin-left: 30rpx;
  206. padding-right: 30rpx;
  207. border-bottom: 1rpx solid #eee;
  208. height: 100rpx;
  209. }
  210. .promoter-order .list .item .listn .itenm .top .pictxt {
  211. width: 320rpx;
  212. }
  213. .promoter-order .list .item .listn .itenm .top .pictxt .text {
  214. width: 230rpx;
  215. font-size: 30rpx;
  216. color: #282828;
  217. }
  218. .promoter-order .list .item .listn .itenm .top .pictxt .pictrue {
  219. width: 66rpx;
  220. height: 66rpx;
  221. }
  222. .promoter-order .list .item .listn .itenm .top .pictxt .pictrue image {
  223. width: 100%;
  224. height: 100%;
  225. border-radius: 50%;
  226. border: 3rpx solid #fff;
  227. box-sizing: border-box;
  228. box-shadow: 0 0 15rpx #aaa;
  229. }
  230. .promoter-order .list .item .listn .itenm .top .money {
  231. font-size: 28rpx;
  232. }
  233. .promoter-order .list .item .listn .itenm .bottom {
  234. padding: 20rpx 30rpx;
  235. font-size: 28rpx;
  236. color: #666;
  237. line-height: 1.6;
  238. position: relative;
  239. .more {
  240. font-size: 24rpx;
  241. position: absolute;
  242. right: 12rpx;
  243. bottom: 24rpx;
  244. .iconfont {
  245. font-size: 22rpx;
  246. margin-left: 5rpx;
  247. }
  248. }
  249. }
  250. .promoter-order .list .item .listn .itenm .bottom .name {
  251. color: #999;
  252. }
  253. </style>