customSale.vue 5.6 KB

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