filtrate.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  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 StoreLabels" :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. <van-checkbox-group v-model="result" direction="horizontal">
  56. <p class="searchchecktitle" @click="otherkkdShow = !otherkkdShow">
  57. &nbsp;可控店<van-icon name="arrow-down" style="float: right" />
  58. </p>
  59. <div v-if="otherkkdShow">
  60. <div v-for="(item, index) in storeTypeLists" :key="index" class="checkbox1">
  61. <div v-if="item.groupType == 'kkd'" class="child">
  62. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  63. </div>
  64. </div>
  65. </div>
  66. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  67. <p class="searchchecktitle" @click="otherfxdShow = !otherfxdShow">
  68. &nbsp;分销店<van-icon name="arrow-down" style="float: right" />
  69. </p>
  70. <div v-if="otherfxdShow" style="margin: 0 14px; width: 100%">
  71. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  72. <p class="searchchecktitle1" @click="otherfxdShow1 = !otherfxdShow1">
  73. 金牌店<van-icon name="arrow-down" style="float: right" />
  74. </p>
  75. <div v-if="otherfxdShow1">
  76. <div v-for="(item1, index1) in storeTypeLists" :key="200 + index1" class="checkbox1">
  77. <div v-if="item1.groupType == 'fxd' && item1.remark == 'jp'" class="child">
  78. <van-checkbox :name="item1.dictValue">{{ item1.dictLabel }}</van-checkbox>
  79. </div>
  80. </div>
  81. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  82. </div>
  83. <p class="searchchecktitle1" @click="otherfxdShow2 = !otherfxdShow2">
  84. 同城分销店<van-icon name="arrow-down" style="float: right" />
  85. </p>
  86. <div v-if="otherfxdShow2">
  87. <div
  88. v-for="(itemlj, indexlj) in storeTypeLists"
  89. :key="400 + indexlj"
  90. class="checkbox1">
  91. <div v-if="itemlj.groupType == 'fxd' && itemlj.remark == 'tcfx'" class="child">
  92. <van-checkbox :name="itemlj.dictValue">{{ itemlj.dictLabel }}</van-checkbox>
  93. </div>
  94. </div>
  95. <div style="clear: both"></div>
  96. </div>
  97. </div>
  98. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  99. <template v-if="postType != 'GZ' && postType != 'JZ'">
  100. <p class="searchchecktitle" @click="isCompetingStores = !isCompetingStores">
  101. &nbsp;潜在客户<van-icon name="arrow-down" style="float: right" />
  102. </p>
  103. <div v-if="isCompetingStores" style="width: 100%">
  104. <div class="checkbox1" v-for="(item, index) in storeTypeLists" :key="index">
  105. <div v-if="item.groupType == 'qzd'" class="child">
  106. <van-checkbox :name="item.dictValue">{{ item.dictLabel }}</van-checkbox>
  107. </div>
  108. </div>
  109. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  110. </div>
  111. <div style="height: 2px; background-color: #f5f5f5; width: 100%; clear: both"></div>
  112. </template>
  113. <p class="searchchecktitle" @click="otherShow = !otherShow">
  114. &nbsp;其他 <van-icon name="arrow-down" style="float: right" />
  115. </p>
  116. <div v-if="otherShow">
  117. <div v-for="(item2, index2) in storeTypeLists" :key="100 + index2" class="checkbox1">
  118. <div v-if="item2.groupType == 'other'" class="child">
  119. <van-checkbox :name="item2.dictValue">{{ item2.dictLabel }}</van-checkbox>
  120. </div>
  121. </div>
  122. </div>
  123. </van-checkbox-group>
  124. </div>
  125. </van-popup>
  126. <van-popup v-model="moreTypeShow" position="bottom" style="height: 80%">
  127. <van-row style="background-color: #f5f5f5">
  128. <van-col span="20">
  129. <van-field
  130. left-icon="search"
  131. style="margin-top: 2px; border-radius: 6px; overflow: hidden"
  132. v-model="CustomerName"
  133. label=""
  134. placeholder="请输入关键词"
  135. clearable />
  136. </van-col>
  137. <van-col span="4" style="text-align: center; line-height: 48px" @click="getCustomer">
  138. <div style="background-color: #0057ba; color: #fff">搜索</div></van-col
  139. >
  140. </van-row>
  141. <van-picker
  142. show-toolbar
  143. :columns="chainsData"
  144. value-key="chainName"
  145. @confirm="onConfirmChainsList"
  146. @cancel="moreTypeShow = false"
  147. visible-item-count="10" />
  148. </van-popup>
  149. </div>
  150. </template>
  151. <script>
  152. import { getCustomerList, getStoreLabels, getStoreTypeListlp, buryingPoint } from '@/api/index';
  153. export default {
  154. name: 'filtrate',
  155. props: {
  156. showFilter: {
  157. type: Boolean,
  158. default: false,
  159. },
  160. },
  161. watch: {
  162. showFilter: {
  163. handler(val) {
  164. // this.CustomerName = '';
  165. },
  166. deep: true,
  167. immediate: true,
  168. },
  169. },
  170. data() {
  171. return {
  172. CustomerName: '',
  173. storeCategoryList: '',
  174. storeLabelTypes: [],
  175. chainName: '',
  176. chainCode: '',
  177. chainsData: [],
  178. moreTypeShow: false,
  179. otherShow: false,
  180. otherbqShow: true,
  181. StoreLabels: [],
  182. result: [],
  183. otherkkdShow: true,
  184. storeTypeLists: [],
  185. otherfxdShow: true,
  186. otherfxdShow1: true,
  187. otherfxdShow2: true,
  188. isCompetingStores: true,
  189. postType: '',
  190. };
  191. },
  192. activated() {
  193. this.postType = localStorage.getItem('postType');
  194. if (this.postType == 'GZ') {
  195. this.otherShow = true;
  196. } else {
  197. this.otherShow = false;
  198. }
  199. },
  200. created() {},
  201. mounted() {
  202. this.getStoreLabels();
  203. this.getStoreTypeList();
  204. },
  205. methods: {
  206. closePopup(flag = false) {
  207. // flag 是否筛选列表
  208. let params = {};
  209. if (flag) {
  210. params = {
  211. chainCode: this.chainCode ? this.chainCode : '',
  212. storeLabelTypes: this.storeLabelTypes.join(','),
  213. storeCategoryList: this.storeCategoryList,
  214. };
  215. }
  216. this.$emit('closePopup', flag, params);
  217. },
  218. handleTouch(e) {
  219. e._isScroller = true;
  220. },
  221. onsets() {
  222. this.result = [];
  223. this.storeLabelTypes = [];
  224. this.storeCategoryList = this.result.join(',');
  225. this.chainName = '';
  226. this.chainCode = '';
  227. this.closePopup(true);
  228. },
  229. moreTypeShowFn() {
  230. this.moreTypeShow = true;
  231. this.getCustomer();
  232. },
  233. getCustomer() {
  234. getCustomerList({ name: this.CustomerName }).then((request) => {
  235. this.chainsData = request.data;
  236. this.chainsData.push({});
  237. this.chainsData.pop();
  238. });
  239. },
  240. onConfirm(value) {
  241. this.storeCategoryList = this.result.join(',');
  242. this.onSearchm();
  243. },
  244. onSearchm() {
  245. var StoreLabelsArr = [];
  246. for (var k = 0; k < this.storeLabelTypes.length; k++) {
  247. for (var k1 = 0; k1 < this.StoreLabels.length; k1++) {
  248. if (this.StoreLabels[k1].dictValue == this.storeLabelTypes[k]) {
  249. StoreLabelsArr.push(this.StoreLabels[k1].dictLabel);
  250. }
  251. }
  252. }
  253. var storeCategoryList = [];
  254. for (var q = 0; q < this.result.length; q++) {
  255. for (var q1 = 0; q1 < this.storeTypeLists.length; q1++) {
  256. if (this.storeTypeLists[q1].dictValue == this.result[q]) {
  257. storeCategoryList.push(this.storeTypeLists[q1].dictLabel);
  258. }
  259. }
  260. }
  261. if (this.chainName != '' && this.chainName != 'null') {
  262. buryingPoint({
  263. systemModel: '计划内',
  264. buryingPointType: 1,
  265. buryingPointValue: this.chainName,
  266. buryingPointName: '经销商筛选',
  267. buryingPointPosition: '计划内',
  268. });
  269. }
  270. localStorage.setItem('outvstoreName', this.storeName);
  271. localStorage.setItem('outvchainName', this.chainName);
  272. localStorage.setItem('outvstoreLabelTypes', this.storeLabelTypes);
  273. localStorage.setItem('outvstoreCategoryList', this.result);
  274. localStorage.setItem('outvchainCode', this.chainCode);
  275. this.closePopup(true);
  276. },
  277. onConfirmChainsList(value) {
  278. if (value.chainName != undefined) {
  279. this.chainName = value.chainName;
  280. this.chainCode = value.chainCode;
  281. }
  282. this.showPickerChainsList = false;
  283. this.moreTypeShow = false;
  284. },
  285. getStoreLabels() {
  286. getStoreLabels().then((res) => {
  287. this.StoreLabels = res.data;
  288. });
  289. },
  290. getStoreTypeList() {
  291. getStoreTypeListlp({}).then((res) => {
  292. this.storeTypeLists = res.data;
  293. this.storeTypeList = res.data;
  294. });
  295. },
  296. },
  297. };
  298. </script>
  299. <style lang="scss" scoped>
  300. .filtrate {
  301. .textsize {
  302. font-size: 14px;
  303. /* overflow: hidden; */
  304. display: flex;
  305. flex-direction: column;
  306. .searchcheck {
  307. flex: 1;
  308. overflow-y: auto;
  309. margin-bottom: 50px;
  310. }
  311. }
  312. .searchcheck {
  313. padding: 0 10px 10px;
  314. }
  315. .searchcheck .van-checkbox {
  316. /*width: 44%;*/
  317. padding-bottom: 10px;
  318. }
  319. .searchcheck .checkbox {
  320. font-size: 14px;
  321. display: inline-block;
  322. width: 50%;
  323. line-height: 28px;
  324. }
  325. .searchcheck .checkbox .van-checkbox {
  326. margin-bottom: 2px;
  327. }
  328. .searchcheck .checkbox1 {
  329. font-size: 14px;
  330. float: left;
  331. line-height: 28px;
  332. width: 50%;
  333. }
  334. .searchcheck .checkbox1 .child {
  335. width: 100%;
  336. }
  337. .searchcheck {
  338. /* height: 93vh;
  339. overflow-y: auto; */
  340. }
  341. .searchchecktitle {
  342. width: 100%;
  343. margin: 20px 0;
  344. font-size: 16px;
  345. border-left: 3px solid #0057ba;
  346. line-height: 18px;
  347. }
  348. }
  349. </style>