index.vue 7.4 KB

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