totalAward.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305
  1. <template>
  2. <view class="total-award-container">
  3. <JHeader :dark="false" title="累计奖励" width="50" height="50" style="padding: 24upx 0 0;"></JHeader>
  4. <view>
  5. <view class="totalAward-topBackImg flex-items flex-column">
  6. <view class="totalAward-content flex-column font-color-FFF">
  7. <view class="flex-column-plus flex-items mar-top-40">
  8. <label class="mar-top-20 fs60 amount">{{ directSalesDataList.total }}</label>
  9. </view>
  10. <view class="flex-row-plus flex-sp-around fs24 mar-top-10">
  11. <view class="awardBox">
  12. <view class="fs36 font-color-FFF">{{ directSalesDataList.directPrice }}</view>
  13. <view class="awardTit font-color-FFF">直接奖励(元)</view>
  14. </view>
  15. <view class="awardBox">
  16. <view class="fs36 font-color-FFF">{{ directSalesDataList.indirectPrice }}</view>
  17. <view class="awardTit font-color-FFF">间接奖励(元)</view>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <view>
  23. <tui-tabs
  24. style="width: 750upx;padding: 0 0upx 0 0upx;overflow: hidden;" :slider-width="60" :padding="0"
  25. item-width="375rpx" selected-color="#C5AA7B" bold slider-bg-color="#999999"
  26. background-color="#333333" unlined
  27. :tabs="[{ name: '直接奖励' }, { name: '间接奖励' }]" :current-tab="awardTypeFlag" @change="awardTypeActive"
  28. ></tui-tabs>
  29. </view>
  30. <view v-if="awardTypeFlag == 0">
  31. <view v-if="directSalesInfo.data && directSalesInfo.data.length">
  32. <view v-for="(item, index) in directSalesInfo.data" :key="index" class="flex-center">
  33. <view class="directAward-box font-color-656 fs26" @click="arrowTypeChange1(index)">
  34. <view style="display: flex;" class="directAwardInfo">
  35. <view style="flex: 1;" class="flex-items flex-sp-between">
  36. <label class="orderId-box font-color-999">订单号:{{ item.orderFormid }}</label>
  37. <view class="mar-right-50 font-color-999">
  38. 佣金:<label class="font-color-C5AA7B">¥{{ item.commission }}</label>
  39. </view>
  40. </view>
  41. <view>
  42. <tui-icon
  43. :name="item.ifOpen ? 'arrowup' : 'arrowdown'" :size="30" unit="upx" margin="0"
  44. color="#b7b7b7"
  45. ></tui-icon>
  46. </view>
  47. </view>
  48. <view v-if="item.ifOpen == true">
  49. <view class="flex-row-plus flex-items flex-sp-between mar-top-30">
  50. <label class="orderId-box font-color-999">商品数:{{ item.products }}</label>
  51. <label class="commission-box mar-left-70 font-color-999">实付金额:¥{{ item.price }}</label>
  52. </view>
  53. <view class="flex-row-plus flex-items flex-sp-between mar-top-30">
  54. <label class="orderId-box font-color-999">下单人:{{ item.customerName }}</label>
  55. <label class="commission-box mar-left-70">
  56. 状态:
  57. <text class="state" :class="{ current: item.state == 0 }">
  58. {{ item.state == 1 ? '未结算' : '已结算' }}
  59. </text>
  60. </label>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. <view style="padding-bottom: 45upx;">
  67. <LoadingMore
  68. :status="!directSalesInfo.isEmpty && !directSalesInfo.data.length
  69. ? 'loading' : !directSalesInfo.isEmpty && directSalesInfo.data.length && (directSalesInfo.data.length >= directSalesInfo.listTotal) ? 'no-more' : ''"
  70. >
  71. </LoadingMore>
  72. <tui-no-data v-if="directSalesInfo.isEmpty" :fixed="false" style="margin-top: 60upx;">这里空空如也~</tui-no-data>
  73. </view>
  74. </view>
  75. <view v-if="awardTypeFlag == 1">
  76. <view v-if="secondhandSalesInfo.data && secondhandSalesInfo.data.length">
  77. <view v-for="(item, index) in secondhandSalesInfo.data" :key="index" class="flex-center">
  78. <view class="directAward-box font-color-656 fs26" @click="arrowTypeChange(index)">
  79. <view style="display: flex;" class="directAwardInfo">
  80. <view style="flex: 1;" class="flex-items flex-sp-between">
  81. <label class="orderId-box font-color-999">订单号:{{ item.orderFormid }}</label>
  82. <view class="mar-right-50 font-color-999">
  83. 佣金:<label class="font-color-C5AA7B">¥{{ item.commission }}</label>
  84. </view>
  85. </view>
  86. <view>
  87. <tui-icon
  88. :name="item.ifOpen ? 'arrowup' : 'arrowdown'" :size="30" unit="upx" margin="0"
  89. color="#b7b7b7"
  90. ></tui-icon>
  91. </view>
  92. </view>
  93. <view v-if="item.ifOpen == true">
  94. <view class="flex-row-plus flex-items flex-sp-between mar-top-30">
  95. <label class="orderId-box font-color-999">商品数:{{ item.products }}</label>
  96. <label class="commission-box mar-left-70 font-color-999">实付金额:¥{{ item.price }}</label>
  97. </view>
  98. <view class="flex-row-plus flex-items flex-sp-between mar-top-30">
  99. <label class="orderId-box font-color-999">下单人:{{ item.customerName }}</label>
  100. <label class="commission-box mar-left-70">
  101. 状态:
  102. <text class="state" :class="{ current: item.state == 0 }">
  103. {{ item.state == 0 ? '未结算' : '已结算' }}
  104. </text>
  105. </label>
  106. </view>
  107. <view class="flex-row-plus flex-items mar-top-30">
  108. <label class="orderId-box font-color-999">分销员:{{ item.distributorName }}</label>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. <view style="padding-bottom: 45upx;">
  115. <LoadingMore
  116. :status="!secondhandSalesInfo.isEmpty && !secondhandSalesInfo.data.length
  117. ? 'loading' : !secondhandSalesInfo.isEmpty && secondhandSalesInfo.data.length && (secondhandSalesInfo.data.length >= secondhandSalesInfo.listTotal) ? 'no-more' : ''"
  118. >
  119. </LoadingMore>
  120. <tui-no-data v-if="secondhandSalesInfo.isEmpty" :fixed="false" style="margin-top: 60upx;">这里空空如也~</tui-no-data>
  121. </view>
  122. </view>
  123. </view>
  124. </view>
  125. </template>
  126. <script>
  127. import { getRewardDistributorApi } from '../../../api/anotherTFInterface'
  128. export default {
  129. name: 'TotalAward',
  130. data() {
  131. return {
  132. awardTypeFlag: 0,
  133. directSalesDataList: {},
  134. secondhandSalesDataList: {},
  135. shopId: 0,
  136. distributorId: 0,
  137. directSalesInfo: {
  138. query: {
  139. type: 1,
  140. page: 1,
  141. pageSize: 10
  142. },
  143. data: [],
  144. listTotal: 0,
  145. isEmpty: false
  146. },
  147. secondhandSalesInfo: {
  148. query: {
  149. type: 2,
  150. page: 1,
  151. pageSize: 10
  152. },
  153. data: [],
  154. listTotal: 0, // 列表数据总数
  155. isEmpty: false // 列表是否为空
  156. }
  157. }
  158. },
  159. onLoad(optins) {
  160. this.shopId = optins.shopId
  161. this.distributorId = optins.distributorId
  162. this.getDirectSalesDataList()
  163. },
  164. methods: {
  165. awardTypeActive(e) {
  166. this.awardTypeFlag = e.index
  167. // 缓存每个tab里的数据
  168. if (this.awardTypeFlag === 0) {
  169. } else if (this.awardTypeFlag === 1) {
  170. if (!this.secondhandSalesInfo.isEmpty && !this.secondhandSalesInfo.data.length) this.getSecondhandSalesDataList()
  171. }
  172. // 每点一个tab就重新进行对它的请求
  173. // if (this.awardTypeFlag === 0) {
  174. // this.directSalesInfo.query.page = 1
  175. // this.directSalesInfo.data = []
  176. // this.directSalesInfo.listTotal = 0
  177. // this.directSalesInfo.isEmpty = false
  178. // this.getApplyByStoreList()
  179. // } else if (this.awardTypeFlag === 1) {
  180. // this.secondhandSalesInfo.query.page = 1
  181. // this.secondhandSalesInfo.data = []
  182. // this.secondhandSalesInfo.listTotal = 0
  183. // this.secondhandSalesInfo.isEmpty = false
  184. // this.getApplyByUserList()
  185. // }
  186. },
  187. getDirectSalesDataList(isLoadmore) {
  188. uni.showLoading()
  189. getRewardDistributorApi({ ...this.directSalesInfo.query, shopId: this.shopId, distributorId: this.distributorId })
  190. .then((res) => {
  191. this.directSalesDataList = res.data
  192. this.directSalesInfo.listTotal = res.data.page.total
  193. if (isLoadmore) {
  194. this.directSalesInfo.data.push(...res.data.page.list)
  195. } else {
  196. this.directSalesInfo.data = res.data.page.list
  197. }
  198. this.directSalesInfo.isEmpty = this.directSalesInfo.data.length === 0
  199. uni.hideLoading()
  200. })
  201. .catch(() => {
  202. uni.hideLoading()
  203. })
  204. },
  205. getSecondhandSalesDataList(isLoadmore) {
  206. uni.showLoading()
  207. getRewardDistributorApi({ ...this.secondhandSalesInfo.query, shopId: this.shopId, distributorId: this.distributorId })
  208. .then((res) => {
  209. this.secondhandSalesDataList = res.data
  210. this.secondhandSalesInfo.listTotal = res.data.page.total
  211. if (isLoadmore) {
  212. this.secondhandSalesInfo.data.push(...res.data.page.list)
  213. } else {
  214. this.secondhandSalesInfo.data = res.data.page.list
  215. }
  216. this.secondhandSalesInfo.isEmpty = this.secondhandSalesInfo.data.length === 0
  217. uni.hideLoading()
  218. })
  219. .catch(() => {
  220. uni.hideLoading()
  221. })
  222. },
  223. arrowTypeChange1(arrowTypeId) {
  224. this.directSalesInfo.data[arrowTypeId].ifOpen = this.directSalesInfo.data[arrowTypeId].ifOpen == false
  225. },
  226. arrowTypeChange(arrowTypeId) {
  227. this.secondhandSalesInfo.data[arrowTypeId].ifOpen = this.secondhandSalesInfo.data[arrowTypeId].ifOpen == false
  228. }
  229. },
  230. onReachBottom() {
  231. if (this.awardTypeFlag === 0) {
  232. if (this.directSalesInfo.data.length < this.directSalesInfo.listTotal) {
  233. ++this.directSalesInfo.query.page
  234. this.getDirectSalesDataList(true)
  235. }
  236. } else if (this.awardTypeFlag === 1) {
  237. if (this.secondhandSalesInfo.data.length < this.secondhandSalesInfo.listTotal) {
  238. ++this.secondhandSalesInfo.query.page
  239. this.getSecondhandSalesDataList(true)
  240. }
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="less" scoped>
  246. .total-award-container {
  247. min-height: 100%;
  248. background-color: #333333;
  249. box-sizing: border-box;
  250. }
  251. .totalAward-topBackImg {
  252. width: 100%;
  253. background-color: #535353;
  254. margin-top: 30 rpx;
  255. padding-bottom: 20upx;
  256. .totalAward-content {
  257. width: 90%;
  258. .awardBox {
  259. text-align: center;
  260. .awardTit {
  261. opacity: 0.7;
  262. }
  263. }
  264. .amount {
  265. color: #FFEBC4;
  266. }
  267. }
  268. }
  269. .directAward-box {
  270. width: 94%;
  271. border-bottom: 1 upx solid #666666;
  272. padding: 30 upx;
  273. display: flex;
  274. justify-content: flex-start;
  275. flex-direction: column;
  276. background: #FFFFFF;
  277. margin-top: 30 rpx;
  278. .orderId-box {
  279. display: flex;
  280. justify-content: flex-start;
  281. flex-direction: row;
  282. }
  283. .state {
  284. color: #16BB89;
  285. }
  286. .current {
  287. color: #C83732 !important;
  288. }
  289. }
  290. </style>