filtrate.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429
  1. <template>
  2. <div class="filtrate">
  3. <van-popup v-model="showFilter" position="bottom" class="textsize" @close="closePopup">
  4. <van-row
  5. style="
  6. width: 100%;
  7. z-index: 998;
  8. background-color: #fff;
  9. border-bottom: 1px solid #ccc;
  10. height: 50px;
  11. ">
  12. <van-col span="3" style="text-align: center; margin: 14px 0" @click="closePopup(false)">
  13. <van-icon name="cross" size="20" color="#909399" />
  14. </van-col>
  15. <van-col span="13"> </van-col>
  16. <van-col span="4" style="text-align: center; line-height: 36px" @click="onConfirm">
  17. <div style="color: #0057ba">
  18. <van-button type="info" size="small" color="#0057ba">筛选</van-button>
  19. </div></van-col
  20. >
  21. <van-col span="4" style="text-align: center; line-height: 36px" @click="onsets">
  22. <van-button type="default" size="small" style="height: 28px">重置</van-button>
  23. </van-col>
  24. </van-row>
  25. <div class="searchcheck" @touchmove="handleTouch">
  26. <p class="searchchecktitle">&nbsp;经销商</p>
  27. <van-row>
  28. <van-col span="24">
  29. <div @click="moreTypeShowFn">
  30. <van-field
  31. style="
  32. margin-top: -6px;
  33. border-radius: 6px;
  34. border: 1px solid #ccc;
  35. overflow: hidden;
  36. "
  37. readonly
  38. v-model="chainName"
  39. label=""
  40. placeholder="请选择经销商" />
  41. </div>
  42. </van-col>
  43. </van-row>
  44. <p class="searchchecktitle" @click="otherbqShow = !otherbqShow">
  45. &nbsp;门店标签<van-icon name="arrow-down" style="float: right" />
  46. </p>
  47. <van-checkbox-group v-model="storeLabelTypes" direction="horizontal">
  48. <div v-if="otherbqShow" style="width: 100%">
  49. <div class="checkbox" v-for="(item, index) in storeLabelsRegular" :key="index">
  50. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  51. </div>
  52. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  53. </div>
  54. </van-checkbox-group>
  55. <p class="searchchecktitle" @click="otherjpdShow = !otherjpdShow">
  56. &nbsp;门店等级<van-icon name="arrow-down" style="float: right" />
  57. </p>
  58. <van-checkbox-group v-model="jpdStoreLevelTypes" direction="horizontal">
  59. <div v-if="otherjpdShow" style="width: 100%">
  60. <div class="checkbox" v-for="(item, index) in jpdStoreLevels" :key="'jpd' + index">
  61. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  62. </div>
  63. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  64. </div>
  65. </van-checkbox-group>
  66. <van-checkbox-group v-model="result" direction="horizontal">
  67. <p class="searchchecktitle" @click="otherkkdShow = !otherkkdShow">
  68. &nbsp;可控店<van-icon name="arrow-down" style="float: right" />
  69. </p>
  70. <div v-if="otherkkdShow">
  71. <div v-for="(item, index) in storeTypeLists" :key="index" class="checkbox1">
  72. <div v-if="item.groupType == 'kkd'" class="child">
  73. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  74. </div>
  75. </div>
  76. </div>
  77. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  78. <p class="searchchecktitle" @click="otherfxdShow = !otherfxdShow">
  79. &nbsp;分销店<van-icon name="arrow-down" style="float: right" />
  80. </p>
  81. <div v-if="otherfxdShow" style="margin: 0 14px; width: 100%">
  82. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  83. <p class="searchchecktitle1" @click="otherfxdShow1 = !otherfxdShow1">
  84. 金牌店<van-icon name="arrow-down" style="float: right" />
  85. </p>
  86. <div v-if="otherfxdShow1">
  87. <div v-for="(item1, index1) in storeTypeLists" :key="200 + index1" class="checkbox1">
  88. <div v-if="item1.groupType == 'fxd' && item1.remark == 'jp'" class="child">
  89. <van-checkbox :name="item1.dictValue">{{ item1.dictLabel }}</van-checkbox>
  90. </div>
  91. </div>
  92. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  93. </div>
  94. <p class="searchchecktitle1" @click="otherfxdShow2 = !otherfxdShow2">
  95. 同城分销店<van-icon name="arrow-down" style="float: right" />
  96. </p>
  97. <div v-if="otherfxdShow2">
  98. <div
  99. v-for="(itemlj, indexlj) in storeTypeLists"
  100. :key="400 + indexlj"
  101. class="checkbox1">
  102. <div v-if="itemlj.groupType == 'fxd' && itemlj.remark == 'tcfx'" class="child">
  103. <van-checkbox :name="itemlj.dictValue">{{ itemlj.dictLabel }}</van-checkbox>
  104. </div>
  105. </div>
  106. <div style="clear: both"></div>
  107. </div>
  108. </div>
  109. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  110. <template v-if="postType != 'GZ' && postType != 'JZ'">
  111. <p class="searchchecktitle" @click="isCompetingStores = !isCompetingStores">
  112. &nbsp;潜在客户<van-icon name="arrow-down" style="float: right" />
  113. </p>
  114. <div v-if="isCompetingStores" style="width: 100%">
  115. <div class="checkbox1" v-for="(item, index) in storeTypeLists" :key="index">
  116. <div v-if="item.groupType == 'qzd'" class="child">
  117. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  118. </div>
  119. </div>
  120. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  121. </div>
  122. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  123. </template>
  124. <p class="searchchecktitle" @click="otherShow = !otherShow">
  125. &nbsp;其他 <van-icon name="arrow-down" style="float: right" />
  126. </p>
  127. <div v-if="otherShow">
  128. <div v-for="(item2, index2) in storeTypeLists" :key="100 + index2" class="checkbox1">
  129. <div v-if="item2.groupType == 'other'" class="child">
  130. <van-checkbox :name="item2.dictValue">{{ item2.dictLabel }}</van-checkbox>
  131. </div>
  132. </div>
  133. </div>
  134. </van-checkbox-group>
  135. </div>
  136. </van-popup>
  137. <van-popup v-model="moreTypeShow" position="bottom" style="height: 80%">
  138. <van-row style="background-color: #f5f5f5">
  139. <van-col span="20">
  140. <van-field
  141. left-icon="search"
  142. style="margin-top: 2px; border-radius: 6px; overflow: hidden"
  143. v-model="CustomerName"
  144. label=""
  145. placeholder="请输入关键词"
  146. clearable />
  147. </van-col>
  148. <van-col span="4" style="text-align: center; line-height: 48px" @click="getCustomer">
  149. <div style="background-color: #0057ba; color: #fff">搜索</div></van-col
  150. >
  151. </van-row>
  152. <van-picker
  153. show-toolbar
  154. :columns="chainsData"
  155. value-key="chainName"
  156. @confirm="onConfirmChainsList"
  157. @cancel="moreTypeShow = false"
  158. visible-item-count="10" />
  159. </van-popup>
  160. </div>
  161. </template>
  162. <script>
  163. import { getCustomerList, getStoreLabels, getStoreTypeListlp, buryingPoint } from '@/api/index';
  164. export default {
  165. name: 'filtrate',
  166. props: {
  167. showFilter: {
  168. type: Boolean,
  169. default: false,
  170. },
  171. },
  172. watch: {
  173. showFilter: {
  174. handler(val) {
  175. if (val) {
  176. this.storeName = localStorage.getItem('outvstoreName') || '';
  177. this.chainName = localStorage.getItem('outvchainName') || '';
  178. this.chainCode = localStorage.getItem('outvchainCode') || '';
  179. this.storeLabelTypes = (localStorage.getItem('outvstoreLabelTypes') || '')
  180. .split(',')
  181. .filter(Boolean);
  182. this.jpdStoreLevelTypes = (localStorage.getItem('outvjpdStoreLevelTypes') || '')
  183. .split(',')
  184. .filter(Boolean);
  185. this.result = (localStorage.getItem('outvstoreCategoryList') || '')
  186. .split(',')
  187. .filter(Boolean);
  188. }
  189. },
  190. deep: true,
  191. immediate: true,
  192. },
  193. },
  194. data() {
  195. return {
  196. CustomerName: '',
  197. storeCategoryList: '',
  198. storeLabelTypes: [],
  199. chainName: '',
  200. chainCode: '',
  201. chainsData: [],
  202. moreTypeShow: false,
  203. otherShow: false,
  204. otherbqShow: true,
  205. StoreLabels: [],
  206. storeLabelsRegular: [],
  207. jpdStoreLevels: [],
  208. jpdStoreLevelTypes: [],
  209. otherjpdShow: true,
  210. result: [],
  211. otherkkdShow: true,
  212. storeTypeLists: [],
  213. otherfxdShow: true,
  214. otherfxdShow1: true,
  215. otherfxdShow2: true,
  216. isCompetingStores: true,
  217. postType: '',
  218. };
  219. },
  220. activated() {
  221. this.postType = localStorage.getItem('postType');
  222. if (this.postType == 'GZ') {
  223. this.otherShow = true;
  224. } else {
  225. this.otherShow = false;
  226. }
  227. },
  228. created() {
  229. this.storeName = localStorage.getItem('outvstoreName') || '';
  230. this.chainName = localStorage.getItem('outvchainName') || '';
  231. this.chainCode = localStorage.getItem('outvchainCode') || '';
  232. this.storeLabelTypes = (localStorage.getItem('outvstoreLabelTypes') || '')
  233. .split(',')
  234. .filter(Boolean);
  235. this.jpdStoreLevelTypes = (localStorage.getItem('outvjpdStoreLevelTypes') || '')
  236. .split(',')
  237. .filter(Boolean);
  238. this.result = (localStorage.getItem('outvstoreCategoryList') || '').split(',').filter(Boolean);
  239. },
  240. mounted() {
  241. this.getStoreLabels();
  242. this.getStoreTypeList();
  243. },
  244. methods: {
  245. closePopup(flag = false) {
  246. // flag 是否筛选列表
  247. let params = {};
  248. if (flag) {
  249. var storeLabelTypes = this.storeLabelTypes.concat(this.jpdStoreLevelTypes);
  250. params = {
  251. chainCode: this.chainCode ? this.chainCode : '',
  252. storeLabelTypes: storeLabelTypes.join(','),
  253. storeCategoryList: this.storeCategoryList,
  254. };
  255. }
  256. this.$emit('closePopup', flag, params);
  257. },
  258. handleTouch(e) {
  259. e._isScroller = true;
  260. },
  261. onsets() {
  262. localStorage.setItem('outvstoreName', '');
  263. localStorage.setItem('outvchainName', '');
  264. localStorage.removeItem('outvstoreLabelTypes');
  265. localStorage.removeItem('outvjpdStoreLevelTypes');
  266. localStorage.removeItem('outvstoreCategoryList');
  267. localStorage.setItem('outvchainCode', '');
  268. localStorage.setItem('lat', '');
  269. localStorage.setItem('lon', '');
  270. this.result = [];
  271. this.storeLabelTypes = [];
  272. this.jpdStoreLevelTypes = [];
  273. this.storeCategoryList = this.result.join(',');
  274. this.chainName = '';
  275. this.chainCode = '';
  276. this.closePopup(true);
  277. },
  278. moreTypeShowFn() {
  279. this.moreTypeShow = true;
  280. this.getCustomer();
  281. },
  282. getCustomer() {
  283. getCustomerList({ name: this.CustomerName }).then((request) => {
  284. this.chainsData = request.data;
  285. this.chainsData.push({});
  286. this.chainsData.pop();
  287. });
  288. },
  289. onConfirm(value) {
  290. this.storeCategoryList = this.result.join(',');
  291. this.onSearchm();
  292. },
  293. onSearchm() {
  294. var StoreLabelsArr = [];
  295. for (var k = 0; k < this.storeLabelTypes.length; k++) {
  296. for (var k1 = 0; k1 < this.storeLabelsRegular.length; k1++) {
  297. if (this.storeLabelsRegular[k1].dictValue == this.storeLabelTypes[k]) {
  298. StoreLabelsArr.push(this.storeLabelsRegular[k1].dictLabel);
  299. }
  300. }
  301. }
  302. var jpdStoreLabelsArr = [];
  303. for (var k = 0; k < this.jpdStoreLevelTypes.length; k++) {
  304. for (var k1 = 0; k1 < this.jpdStoreLevels.length; k1++) {
  305. if (this.jpdStoreLevels[k1].dictValue == this.jpdStoreLevelTypes[k]) {
  306. jpdStoreLabelsArr.push(this.jpdStoreLevels[k1].dictLabel);
  307. }
  308. }
  309. }
  310. var storeCategoryList = [];
  311. for (var q = 0; q < this.result.length; q++) {
  312. for (var q1 = 0; q1 < this.storeTypeLists.length; q1++) {
  313. if (this.storeTypeLists[q1].dictValue == this.result[q]) {
  314. storeCategoryList.push(this.storeTypeLists[q1].dictLabel);
  315. }
  316. }
  317. }
  318. if (StoreLabelsArr.length > 0) {
  319. buryingPoint({
  320. systemModel: '计划内',
  321. buryingPointType: 1,
  322. buryingPointValue: StoreLabelsArr.join(','),
  323. buryingPointName: '标签',
  324. buryingPointPosition: '计划内',
  325. });
  326. }
  327. if (jpdStoreLabelsArr.length > 0) {
  328. buryingPoint({
  329. systemModel: '计划内',
  330. buryingPointType: 1,
  331. buryingPointValue: jpdStoreLabelsArr.join(','),
  332. buryingPointName: '金牌店等级',
  333. buryingPointPosition: '计划内',
  334. });
  335. }
  336. if (this.chainName != '' && this.chainName != 'null') {
  337. buryingPoint({
  338. systemModel: '计划内',
  339. buryingPointType: 1,
  340. buryingPointValue: this.chainName,
  341. buryingPointName: '经销商筛选',
  342. buryingPointPosition: '计划内',
  343. });
  344. }
  345. localStorage.setItem('outvstoreName', this.storeName);
  346. localStorage.setItem('outvchainName', this.chainName);
  347. localStorage.setItem('outvstoreLabelTypes', this.storeLabelTypes);
  348. localStorage.setItem('outvjpdStoreLevelTypes', this.jpdStoreLevelTypes);
  349. localStorage.setItem('outvstoreCategoryList', this.result);
  350. localStorage.setItem('outvchainCode', this.chainCode);
  351. this.closePopup(true);
  352. },
  353. onConfirmChainsList(value) {
  354. if (value.chainName != undefined) {
  355. this.chainName = value.chainName;
  356. this.chainCode = value.chainCode;
  357. }
  358. this.showPickerChainsList = false;
  359. this.moreTypeShow = false;
  360. },
  361. getStoreLabels() {
  362. getStoreLabels().then((res) => {
  363. this.StoreLabels = res.data || [];
  364. this.storeLabelsRegular = this.StoreLabels.filter((item) => item.ifJpdStoreLevel != '1');
  365. this.jpdStoreLevels = this.StoreLabels.filter((item) => item.ifJpdStoreLevel == '1');
  366. });
  367. },
  368. getStoreTypeList() {
  369. getStoreTypeListlp({}).then((res) => {
  370. this.storeTypeLists = res.data;
  371. this.storeTypeList = res.data;
  372. });
  373. },
  374. },
  375. };
  376. </script>
  377. <style lang="scss" scoped>
  378. .filtrate {
  379. .textsize {
  380. font-size: 14px;
  381. /* overflow: hidden; */
  382. display: flex;
  383. flex-direction: column;
  384. .searchcheck {
  385. flex: 1;
  386. overflow-y: auto;
  387. margin-bottom: 50px;
  388. }
  389. }
  390. .searchcheck {
  391. padding: 0 10px 10px;
  392. }
  393. .searchcheck .van-checkbox {
  394. /*width: 44%;*/
  395. padding-bottom: 10px;
  396. }
  397. .searchcheck .checkbox {
  398. font-size: 14px;
  399. display: inline-block;
  400. width: 50%;
  401. line-height: 28px;
  402. }
  403. .searchcheck .checkbox .van-checkbox {
  404. margin-bottom: 2px;
  405. }
  406. .searchcheck .checkbox1 {
  407. font-size: 14px;
  408. float: left;
  409. line-height: 28px;
  410. width: 50%;
  411. }
  412. .searchcheck .checkbox1 .child {
  413. width: 100%;
  414. }
  415. .searchcheck {
  416. /* height: 93vh;
  417. overflow-y: auto; */
  418. }
  419. .searchchecktitle {
  420. width: 100%;
  421. margin: 20px 0;
  422. font-size: 16px;
  423. border-left: 3px solid #0057ba;
  424. line-height: 18px;
  425. }
  426. }
  427. </style>