filtrate.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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. entry: {
  172. type: Number,
  173. },
  174. },
  175. watch: {
  176. showFilter: {
  177. handler(val) {
  178. // this.CustomerName = '';
  179. if (val) {
  180. this.getStoreTypeList();
  181. this.storeName = localStorage.getItem('outvstoreName') || '';
  182. this.chainName = localStorage.getItem('outvchainName') || '';
  183. this.chainCode = localStorage.getItem('outvchainCode') || '';
  184. this.storeLabelTypes = (localStorage.getItem('outvstoreLabelTypes') || '')
  185. .split(',')
  186. .filter(Boolean);
  187. this.jpdStoreLevelTypes = (localStorage.getItem('outvjpdStoreLevelTypes') || '')
  188. .split(',')
  189. .filter(Boolean);
  190. this.result = (localStorage.getItem('outvstoreCategoryList') || '')
  191. .split(',')
  192. .filter(Boolean);
  193. }
  194. },
  195. deep: true,
  196. immediate: true,
  197. },
  198. },
  199. data() {
  200. return {
  201. CustomerName: '',
  202. storeCategoryList: '',
  203. storeLabelTypes: [],
  204. chainName: '',
  205. chainCode: '',
  206. chainsData: [],
  207. moreTypeShow: false,
  208. otherShow: false,
  209. otherbqShow: true,
  210. StoreLabels: [],
  211. storeLabelsRegular: [],
  212. jpdStoreLevels: [],
  213. jpdStoreLevelTypes: [],
  214. otherjpdShow: true,
  215. result: [],
  216. otherkkdShow: true,
  217. storeTypeLists: [],
  218. otherfxdShow: true,
  219. otherfxdShow1: true,
  220. otherfxdShow2: true,
  221. isCompetingStores: true,
  222. postType: '',
  223. };
  224. },
  225. activated() {
  226. this.postType = localStorage.getItem('postType');
  227. if (this.postType == 'GZ') {
  228. this.otherShow = true;
  229. } else {
  230. this.otherShow = false;
  231. }
  232. },
  233. created() {
  234. this.storeName = localStorage.getItem('outvstoreName') || '';
  235. this.chainName = localStorage.getItem('outvchainName') || '';
  236. this.chainCode = localStorage.getItem('outvchainCode') || '';
  237. this.storeLabelTypes = (localStorage.getItem('outvstoreLabelTypes') || '')
  238. .split(',')
  239. .filter(Boolean);
  240. this.jpdStoreLevelTypes = (localStorage.getItem('outvjpdStoreLevelTypes') || '')
  241. .split(',')
  242. .filter(Boolean);
  243. this.result = (localStorage.getItem('outvstoreCategoryList') || '').split(',').filter(Boolean);
  244. },
  245. mounted() {
  246. this.getStoreLabels();
  247. },
  248. methods: {
  249. closePopup(flag = false) {
  250. // flag 是否筛选列表
  251. let params = {};
  252. if (flag) {
  253. var storeLabelTypes = this.storeLabelTypes.concat(this.jpdStoreLevelTypes);
  254. params = {
  255. chainCode: this.chainCode ? this.chainCode : '',
  256. storeLabelTypes: storeLabelTypes.join(','),
  257. storeCategoryList: this.storeCategoryList,
  258. };
  259. }
  260. this.$emit('closePopup', flag, params);
  261. },
  262. handleTouch(e) {
  263. e._isScroller = true;
  264. },
  265. onsets() {
  266. localStorage.setItem('outvstoreName', '');
  267. localStorage.setItem('outvchainName', '');
  268. localStorage.removeItem('outvstoreLabelTypes');
  269. localStorage.removeItem('outvjpdStoreLevelTypes');
  270. localStorage.removeItem('outvstoreCategoryList');
  271. localStorage.setItem('outvchainCode', '');
  272. localStorage.setItem('lat', '');
  273. localStorage.setItem('lon', '');
  274. this.result = [];
  275. this.storeLabelTypes = [];
  276. this.jpdStoreLevelTypes = [];
  277. this.storeCategoryList = this.result.join(',');
  278. this.chainName = '';
  279. this.chainCode = '';
  280. this.closePopup(true);
  281. },
  282. moreTypeShowFn() {
  283. this.moreTypeShow = true;
  284. this.getCustomer();
  285. },
  286. getCustomer() {
  287. getCustomerList({ name: this.CustomerName }).then((request) => {
  288. this.chainsData = request.data;
  289. this.chainsData.push({});
  290. this.chainsData.pop();
  291. });
  292. },
  293. onConfirm(value) {
  294. this.storeCategoryList = this.result.join(',');
  295. this.onSearchm();
  296. },
  297. onSearchm() {
  298. var StoreLabelsArr = [];
  299. for (var k = 0; k < this.storeLabelTypes.length; k++) {
  300. for (var k1 = 0; k1 < this.storeLabelsRegular.length; k1++) {
  301. if (this.storeLabelsRegular[k1].dictValue == this.storeLabelTypes[k]) {
  302. StoreLabelsArr.push(this.storeLabelsRegular[k1].dictLabel);
  303. }
  304. }
  305. }
  306. var jpdStoreLabelsArr = [];
  307. for (var k = 0; k < this.jpdStoreLevelTypes.length; k++) {
  308. for (var k1 = 0; k1 < this.jpdStoreLevels.length; k1++) {
  309. if (this.jpdStoreLevels[k1].dictValue == this.jpdStoreLevelTypes[k]) {
  310. jpdStoreLabelsArr.push(this.jpdStoreLevels[k1].dictLabel);
  311. }
  312. }
  313. }
  314. var storeCategoryList = [];
  315. for (var q = 0; q < this.result.length; q++) {
  316. for (var q1 = 0; q1 < this.storeTypeLists.length; q1++) {
  317. if (this.storeTypeLists[q1].dictValue == this.result[q]) {
  318. storeCategoryList.push(this.storeTypeLists[q1].dictLabel);
  319. }
  320. }
  321. }
  322. if (StoreLabelsArr.length > 0) {
  323. buryingPoint({
  324. systemModel: '计划内',
  325. buryingPointType: 1,
  326. buryingPointValue: StoreLabelsArr.join(','),
  327. buryingPointName: '标签',
  328. buryingPointPosition: '计划内',
  329. });
  330. }
  331. if (jpdStoreLabelsArr.length > 0) {
  332. buryingPoint({
  333. systemModel: '计划内',
  334. buryingPointType: 1,
  335. buryingPointValue: jpdStoreLabelsArr.join(','),
  336. buryingPointName: '金牌店等级',
  337. buryingPointPosition: '计划内',
  338. });
  339. }
  340. if (this.chainName != '' && this.chainName != 'null') {
  341. buryingPoint({
  342. systemModel: '计划内',
  343. buryingPointType: 1,
  344. buryingPointValue: this.chainName,
  345. buryingPointName: '经销商筛选',
  346. buryingPointPosition: '计划内',
  347. });
  348. }
  349. localStorage.setItem('outvstoreName', this.storeName);
  350. localStorage.setItem('outvchainName', this.chainName);
  351. localStorage.setItem('outvstoreLabelTypes', this.storeLabelTypes);
  352. localStorage.setItem('outvjpdStoreLevelTypes', this.jpdStoreLevelTypes);
  353. localStorage.setItem('outvstoreCategoryList', this.result);
  354. localStorage.setItem('outvchainCode', this.chainCode);
  355. this.closePopup(true);
  356. },
  357. onConfirmChainsList(value) {
  358. if (value.chainName != undefined) {
  359. this.chainName = value.chainName;
  360. this.chainCode = value.chainCode;
  361. }
  362. this.showPickerChainsList = false;
  363. this.moreTypeShow = false;
  364. },
  365. getStoreLabels() {
  366. getStoreLabels().then((res) => {
  367. this.StoreLabels = res.data || [];
  368. this.storeLabelsRegular = this.StoreLabels.filter((item) => item.ifJpdStoreLevel != '1');
  369. this.jpdStoreLevels = this.StoreLabels.filter((item) => item.ifJpdStoreLevel == '1');
  370. });
  371. },
  372. getStoreTypeList() {
  373. getStoreTypeListlp({ entry: this.entry }).then((res) => {
  374. this.storeTypeLists = res.data;
  375. this.storeTypeList = res.data;
  376. });
  377. },
  378. },
  379. };
  380. </script>
  381. <style lang="scss" scoped>
  382. .filtrate {
  383. .textsize {
  384. font-size: 14px;
  385. /* overflow: hidden; */
  386. display: flex;
  387. flex-direction: column;
  388. .searchcheck {
  389. flex: 1;
  390. overflow-y: auto;
  391. margin-bottom: 50px;
  392. }
  393. }
  394. .searchcheck {
  395. padding: 0 10px 10px;
  396. }
  397. .searchcheck .van-checkbox {
  398. /*width: 44%;*/
  399. padding-bottom: 10px;
  400. }
  401. .searchcheck .checkbox {
  402. font-size: 14px;
  403. display: inline-block;
  404. width: 50%;
  405. line-height: 28px;
  406. }
  407. .searchcheck .checkbox .van-checkbox {
  408. margin-bottom: 2px;
  409. }
  410. .searchcheck .checkbox1 {
  411. font-size: 14px;
  412. float: left;
  413. line-height: 28px;
  414. width: 50%;
  415. }
  416. .searchcheck .checkbox1 .child {
  417. width: 100%;
  418. }
  419. .searchcheck {
  420. /* height: 93vh;
  421. overflow-y: auto; */
  422. }
  423. .searchchecktitle {
  424. width: 100%;
  425. margin: 20px 0;
  426. font-size: 16px;
  427. border-left: 3px solid #0057ba;
  428. line-height: 18px;
  429. }
  430. }
  431. </style>