cgStat.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <!--
  2. 供货商业绩:按供货商汇总数量/金额;timeType 切换记账时间(bill) / 发货时间(send)。
  3. -->
  4. <template>
  5. <view class="app-content">
  6. <view class="ex-page">
  7. <view class="input-wrap_box">
  8. <view>
  9. <AppSearchModule placeholder="输入拼音首字母搜索" @input="searchFn"/>
  10. </view>
  11. </view>
  12. <view class="top-bar">
  13. <!-- 记账时间 / 发货时间:只切换筛字段,不另开时间选择器 -->
  14. <view class="time-type-row">
  15. <view class="time-type-item" :class="{ active: params.timeType === 'bill' }" @click="changeTimeType('bill')">记账时间</view>
  16. <view class="time-type-item" :class="{ active: params.timeType === 'send' }" @click="changeTimeType('send')">发货时间</view>
  17. </view>
  18. <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" />
  19. </view>
  20. <view class="main-view">
  21. <view class="space-view ex-table">
  22. <block>
  23. <t-table :headerBackgroundColor="'#F0F2F6'">
  24. <t-tr header><t-th>供货商</t-th><t-th>数量</t-th><t-th>金额</t-th><t-th>操作</t-th></t-tr>
  25. <view v-for="(item, index) in profile" :key="index">
  26. <t-tr>
  27. <t-td><view>{{item.ghsName}}</view></t-td>
  28. <t-td><view>{{parseFloat(item.num)}}</view></t-td>
  29. <t-td><view>{{parseFloat(item.amount)}}</view></t-td>
  30. <t-td></t-td>
  31. </t-tr>
  32. </view>
  33. </t-table>
  34. </block>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  42. import { getStatCgGhsProfile } from "@/api/stat/index";
  43. import { list } from "@/mixins";
  44. import ShopSelect from "@/components/module/shopSelect";
  45. import DateSelect from "@/components/module/dateSelect";
  46. import AppSearchModule from "@/components/module/app-search";
  47. import {mapActions, mapGetters} from "vuex";
  48. export default {
  49. components: { AppWrapperEmpty,ShopSelect,AppSearchModule,DateSelect },
  50. mixins: [list],
  51. computed: { ...mapGetters(["getDictionariesInfo","getLoginInfo"]) },
  52. data() {
  53. return {
  54. isShow:false,
  55. customizationTime:[],
  56. shopId:'',
  57. itemId:'',
  58. nowTime: "",
  59. showTimeDropdown: false,
  60. nowShop: "",
  61. showShopDropdown: false,
  62. columns: [
  63. { name: "姓名", dataIndex: "name", color: "info" },
  64. { name: "开单额", dataIndex: "amount", color: "info", width: 120, align: "center" },
  65. { name: "开单数", dataIndex: "num", color: "info", align: "center" }
  66. ],
  67. dataList: [],
  68. // timeType: bill=记账时间(默认) / send=发货时间
  69. params:{ itemId: '', searchTime:'', startTime: "", endTime: "", shopId: "", timeType: 'bill', },
  70. profile:[],
  71. storageData:[],
  72. searchContent:'',
  73. };
  74. },
  75. onPullDownRefresh() {
  76. this.resetList();
  77. this.getList().then(res => {
  78. uni.stopPullDownRefresh();
  79. });
  80. },
  81. onLoad(e) {
  82. this.itemId = e.id;
  83. this.params.itemId = e.id;
  84. this.shopId = this.getLoginInfo.shopId;
  85. },
  86. methods: {
  87. ...mapActions(['setUserShopAll']),
  88. searchFn(e){
  89. this.searchContent = e;
  90. this.filterStat()
  91. },
  92. filterStat(){
  93. let that = this
  94. if(this.searchContent.length > 0){
  95. that.profile = [];
  96. that.storageData.forEach(obj => {
  97. let hasName = obj.name && obj.name.indexOf(this.searchContent) >= 0;
  98. let elePy = (obj.py && obj.py.toLocaleUpperCase()) || "";
  99. let hasPy = elePy.indexOf(this.searchContent.toLocaleUpperCase()) >= 0;
  100. if (hasName || hasPy) {
  101. that.profile.push(obj)
  102. }
  103. })
  104. }else{
  105. that.profile = that.storageData
  106. }
  107. },
  108. //选择分店
  109. selectShopFn(val){
  110. this.params.shopId = val.id;
  111. this.init();
  112. },
  113. //选择时间
  114. selectDateFn(val) {
  115. this.params = {...this.params,...val}
  116. this.init();
  117. },
  118. /** 切换记账时间 / 发货时间并刷新 */
  119. changeTimeType(type) {
  120. if (this.params.timeType === type) return
  121. this.params.timeType = type
  122. this.init()
  123. },
  124. async init() {
  125. this.getList();
  126. },
  127. getList() {
  128. let that = this
  129. uni.showLoading()
  130. getStatCgGhsProfile(this.params).then(res => {
  131. uni.hideLoading()
  132. if (!this.$util.isEmpty(res.data.list)) {
  133. that.storageData = res.data.list
  134. that.filterStat()
  135. }else{
  136. that.storageData=[]
  137. }
  138. });
  139. }
  140. }
  141. };
  142. </script>
  143. <style lang="scss" scoped>
  144. .ex-page {
  145. background: white;
  146. padding-top:20upx;
  147. height: 100%;
  148. display: flex;
  149. flex-direction: column;
  150. .top-bar {
  151. position: absolute;
  152. left: 0;
  153. top:116upx;
  154. display: flex;
  155. align-items: center;
  156. width: 100%;
  157. z-index: 20;
  158. padding: 0 16upx;
  159. box-sizing: border-box;
  160. .time-type-row {
  161. display: flex;
  162. align-items: center;
  163. flex-shrink: 0;
  164. margin-right: 12upx;
  165. }
  166. .time-type-item {
  167. height: 56upx;
  168. line-height: 56upx;
  169. padding: 0 18upx;
  170. font-size: 26upx;
  171. color: #666;
  172. background: #f5f5f5;
  173. border-radius: 8upx;
  174. margin-right: 10upx;
  175. &:last-child {
  176. margin-right: 0;
  177. }
  178. &.active {
  179. color: #fff;
  180. background: #08b955;
  181. }
  182. }
  183. .bar{
  184. flex: 1;
  185. min-width: 0;
  186. height: 100%;
  187. text-align: center;
  188. }
  189. }
  190. .main-view {
  191. margin-top: 80upx;
  192. flex: 1;
  193. background-color: #f9fbfc;
  194. .space-view {
  195. background-color: #fff;
  196. .change-level{
  197. font-size:22upx;
  198. padding:10upx 15upx;
  199. }
  200. }
  201. .ex-info {
  202. padding: 30upx;
  203. .info-cell {
  204. display: flex;
  205. align-items: center;
  206. font-size: 28upx;
  207. &:not(:first-child) {
  208. margin-top: 20upx;
  209. }
  210. .cell-label {
  211. width: 110upx;
  212. color: #666666;
  213. }
  214. .cell-value {
  215. margin-left: 40upx;
  216. color: #333;
  217. &.warning {
  218. color: #ffaf1d;
  219. }
  220. &.success {
  221. color: #27c325;
  222. }
  223. }
  224. }
  225. }
  226. .ex-table {
  227. ::v-deep.icon-info {
  228. color: #333333;
  229. }
  230. }
  231. }
  232. .bar-view {
  233. display: flex;
  234. justify-content: space-between;
  235. align-items: center;
  236. padding: 0 30upx;
  237. width: 100%;
  238. height: 100upx;
  239. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  240. .info-view {
  241. font-size: 26upx;
  242. }
  243. .btn-view {
  244. display: flex;
  245. .admin-button-com {
  246. margin: 0 10upx;
  247. }
  248. }
  249. }
  250. }
  251. </style>