sales.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view>
  3. <view class="top ddflex">
  4. <!-- <view class="ke"><text>5183</text>实际销售额</view> -->
  5. <view class="datas ddflex fflex">
  6. <view class="li"><view><text>¥</text>{{count.totalMoney}}</view><text>总销售额</text></view>
  7. <view class="fuhao"><!-- - --><image src="../static/promote/images/jian.png" mode="widthFix"></image></view>
  8. <view class="li"><view><text>¥</text>{{count.refundMoney}}</view><text>退款总额</text></view>
  9. <view class="fuhao">=</view>
  10. <view class="li"><view><text>¥</text>{{count.actualMoney}}</view><text>实际销售额</text></view>
  11. </view>
  12. </view>
  13. <view class="tab ddflex">
  14. <view :class="'li' + (tabIndex == -1 ? ' active' : '')" @click="tabClick('',-1)">全部</view>
  15. <view :class="'li' + (tabIndex == index ? ' active' : '')" v-for="(item,index) in typeList" :key="index" @click="tabClick(item.type,index)">{{item.label}}</view>
  16. </view>
  17. <view class="list" v-if="pageList.length > 0">
  18. <block v-for="(item, index) in pageList" :key="index">
  19. <view class="li dflex">
  20. <image :src="item.createAvatar ? item.createAvatar : '../../static/pages/images/userimg.png'"
  21. mode="aspectFill" class="userimg"></image>
  22. <view class="fflex">
  23. <view class="ddflex">
  24. <view class="fflex">
  25. <view class="username">{{item.createName}}</view>
  26. <view class="time" v-if="item.updateDate">{{item.updateDate}}</view>
  27. </view>
  28. <view class="money">¥<text>{{item.orderMoney}}</text></view>
  29. </view>
  30. <view class="name">
  31. <text>订单</text>
  32. {{item.orderId}}
  33. </view>
  34. <view class="pro-buy ddflex" v-if="item.productList && item.productList.length > 0">
  35. <text>购买了</text>
  36. <view class="pro-list fflex">
  37. <view class="lis tover" v-for="(it,idx) in item.productList" :key="idx">{{it.title}}
  38. </view>
  39. </view>
  40. </view>
  41. <view class="opt opts ddflex" v-if="item.state == 3">
  42. <view class="fail">
  43. 已全额退款
  44. </view>
  45. </view>
  46. <view class="opt ddflex" v-else>
  47. <view :class="'shifu ddflex' + (item.state==2 ? ' green' : item.state==1 ? ' dai' : '')"><text>佣金</text>¥<text>{{item.money}}</text></view>
  48. <view class="sta dai" v-if="item.state==1">待结算</view>
  49. <view class="sta green" v-else-if="item.state==2">已结算</view>
  50. </view>
  51. <!-- <block v-else>
  52. <view class="opt dai" v-if="item.refundMoney > 0">
  53. 退款 ¥{{item.refundMoney}}
  54. </view>
  55. </block> -->
  56. </view>
  57. <!-- <view class="flex">
  58. <view class="name">
  59. <text>订单:</text>
  60. {{item.orderId}}
  61. </view>
  62. <view class="dblock">
  63. <text class="moneygray"></text>
  64. <text class="moneygray" v-if="item.orderMoney"> ¥{{item.orderMoney}}</text>
  65. <text class="moneyred" v-if="item.state==1">待结算</text>
  66. <text class="moneygray" v-else-if="item.state==2">已结算</text>
  67. <text class="moneygray" v-else>已取消</text>
  68. </view>
  69. </view>
  70. <view class="money">¥<text>{{item.money}}</text>
  71. <view>
  72. <text class="time" v-if="item.updateDate">{{item.updateDate}}</text>
  73. </view>
  74. </view> -->
  75. </view>
  76. </block>
  77. </view>
  78. <view class="nodata" v-else>
  79. <image :src="picUrlss+'empty_dd.png'"></image>
  80. <text>暂无业绩订单</text>
  81. </view>
  82. </view>
  83. </template>
  84. <script>
  85. // promote/balance/balance.js
  86. const app = getApp();
  87. const req = require("../../utils/request.js");
  88. export default {
  89. data() {
  90. return {
  91. picUrlss: req.public.picUrls,
  92. pageList: [],
  93. form: {
  94. page: 1,
  95. limit: 10
  96. },
  97. isLoad: true,
  98. count: {},
  99. initTypeList: [
  100. {
  101. type: 1,
  102. label: '直接客户'
  103. },
  104. {
  105. type: 2,
  106. label: '分销客户'
  107. },
  108. {
  109. type: 3,
  110. label: '间接客户'
  111. },
  112. {
  113. type: 4,
  114. label: '自购'
  115. }
  116. ],
  117. typeList: [],
  118. tabIndex: -1,
  119. type: ''
  120. };
  121. },
  122. components: {},
  123. props: {},
  124. async onLoad(options) {
  125. this.getCount();
  126. await this.getConfig();
  127. await this.getData();
  128. },
  129. onReachBottom: function() {
  130. if (this.hasmore) return false;
  131. this.form.page++;
  132. this.getData();
  133. },
  134. methods: {
  135. tabClick(type,index){
  136. if(this.tabIndex == index) return false;
  137. this.tabIndex = index;
  138. this.type = type
  139. this.form.page = 1;
  140. this.isLoad = true;
  141. this.getData();
  142. },
  143. getCount(){
  144. req.getRequest('/api/distribution/achievementCount',{},data=>{
  145. this.count = data;
  146. })
  147. },
  148. getConfig(){
  149. return new Promise((resolve,reject)=>{
  150. req.postRequest('/api/distribution/config', {}, res => {
  151. if(!res.salesStatisticsMethod){
  152. if(res.distributionIsSubCommission == 1){
  153. res.salesStatisticsMethod = '1,4'
  154. }else{
  155. res.salesStatisticsMethod = '1,2'
  156. }
  157. }
  158. let method = res.salesStatisticsMethod.split(',')
  159. let arr = []
  160. this.initTypeList.map(it=>{
  161. method.map(its=>{
  162. if(its == it.type){
  163. arr.push(it)
  164. }
  165. })
  166. })
  167. this.typeList = arr;
  168. resolve();
  169. })
  170. })
  171. },
  172. getData() {
  173. if (!this.isLoad) return false;
  174. this.isLoad = false;
  175. let that = this;
  176. let form = that.form
  177. if(that.type){
  178. form.type = that.type
  179. }else{
  180. delete form.type;
  181. }
  182. if(form.page == 1){
  183. uni.showLoading()
  184. }
  185. return new Promise((resolve,reject)=>{
  186. req.getRequest('/api/distribution/distributionOrderList', form, data => {
  187. // console.log(data);
  188. if (data && data.length >= 10) that.isLoad = true;
  189. if (that.form.page > 1) data = that.pageList.concat(data);
  190. that.pageList = data
  191. uni.hideLoading();
  192. resolve();
  193. });
  194. })
  195. }
  196. }
  197. };
  198. </script>
  199. <style>
  200. @import "./sales.css";
  201. </style>