filtrate.vue 11 KB

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