index.js 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. import { activity, User } from "@/config/api.js";
  2. let app = getApp();
  3. export default {
  4. data() {
  5. return {
  6. listActivityStaus: [], //状态
  7. listActivityType: [], //类型
  8. listChartPermission: [], //分类
  9. listChartPermissionInit: [],
  10. activityTypeIds: "", //活动类型id 多个用 , 隔开
  11. chartPermissionIds: "", //行业id 多个用 , 隔开
  12. chartPermissionName: "所有行业",
  13. activityTypeName: "所有类型",
  14. selectShow: false,
  15. isShowJurisdiction: false,
  16. isGain: true,
  17. isId: 0,
  18. activityIdAdd: "",
  19. // 历史搜索列表
  20. historySearchList: [],
  21. flag: false,
  22. activityTimeList: [
  23. { Id: 1, IsChoose: false, StatusName: "今日活动" },
  24. { Id: 2, IsChoose: false, StatusName: "明日活动" },
  25. ],
  26. activityTimeStatus: "",
  27. keyWord: "",
  28. isNeedAddCountryCode: false, //判断是否需要区号
  29. isAreaCode: false,
  30. areaCode: {
  31. id: "",
  32. type: "",
  33. },
  34. };
  35. },
  36. methods: {
  37. // 滑动状态下拉选择的收起
  38. closeTheWindow(type) {
  39. if (type == "statusstate") {
  40. const state = this.activeState ? this.activeState.split(",").map(Number) : [];
  41. this.listActivityStaus.forEach((item) => {
  42. if (state.indexOf(item.Id) !== -1) {
  43. item.IsChoose = true;
  44. } else {
  45. item.IsChoose = false;
  46. }
  47. });
  48. } else if (type == "genre") {
  49. const types = this.activityTypeIds ? this.activityTypeIds.split(",").map(Number) : [];
  50. this.listActivityType.forEach((item) => {
  51. if (types.includes(item.ActivityTypeId)) {
  52. item.IsChoose = true;
  53. } else {
  54. item.IsChoose = false;
  55. }
  56. });
  57. } else {
  58. const chart = this.chartPermissionIds ? this.chartPermissionIds.split(",").map(Number) : [];
  59. this.listChartPermission.forEach((item) => {
  60. if (chart.includes(item.ChartPermissionId)) {
  61. item.IsChoose = true;
  62. } else {
  63. item.IsChoose = false;
  64. }
  65. });
  66. }
  67. },
  68. //是否展示有权限的行业
  69. isJurisdiction() {
  70. if (this.isShowJurisdiction) {
  71. this.isId = 2;
  72. } else {
  73. this.isId = 1;
  74. }
  75. this.getUserSearchContent("traverse");
  76. },
  77. /* 新布局产业选项确定按钮 */
  78. replacementConfirm(type) {
  79. this.page_no = 1;
  80. if (type == "statusstate") {
  81. const arr = [];
  82. const str = [];
  83. this.listActivityStaus.forEach((key) => {
  84. if (key.IsChoose) {
  85. arr.push(key.Id);
  86. str.push(key.StatusName);
  87. }
  88. });
  89. this.activeState = arr.join(",");
  90. const arrTwo = [];
  91. const strTwo = [];
  92. this.activityTimeList.forEach((key) => {
  93. if (key.IsChoose) {
  94. arrTwo.push(key.Id);
  95. strTwo.push(key.StatusName);
  96. }
  97. });
  98. this.activityTimeStatus = arrTwo.join(",");
  99. if (strTwo.length > 0) {
  100. this.activeStateName = strTwo.join(",");
  101. } else {
  102. if (str.length == this.listActivityStaus.length || str.length <= 0) {
  103. this.activeStateName = "所有状态";
  104. } else {
  105. this.activeStateName = str.join(",");
  106. }
  107. }
  108. } else if (type == "industry") {
  109. const arr = [];
  110. const str = [];
  111. this.listChartPermission.forEach((key) => {
  112. if (key.IsChoose) {
  113. arr.push(key.ChartPermissionId);
  114. str.push(key.PermissionName);
  115. }
  116. });
  117. if ((str.length == 6 && this.listChartPermission.length == 6) || str.length <= 0) {
  118. this.chartPermissionName = "所有行业";
  119. } else {
  120. this.chartPermissionName = str.join(",");
  121. }
  122. this.chartPermissionIds = arr.join(",");
  123. } else {
  124. const arr = [];
  125. const str = [];
  126. this.listActivityType.forEach((key) => {
  127. if (key.IsChoose) {
  128. arr.push(key.ActivityTypeId);
  129. str.push(key.ActivityTypeName);
  130. }
  131. });
  132. if (str.length == this.listActivityType.length || str.length <= 0) {
  133. this.activityTypeName = "所有类型";
  134. } else {
  135. this.activityTypeName = str.join(",");
  136. }
  137. this.activityTypeIds = arr.join(",");
  138. }
  139. this.page_no = 1;
  140. this.collectList = [];
  141. this.dynamicList = [];
  142. this.spanIndex = [];
  143. this.keyWord = "";
  144. this.fastSearchKeWord();
  145. this.getList();
  146. this.selectComponent(`#${type}`).toggle();
  147. },
  148. /* 新布局产业选项重置按钮 */
  149. replacementBtn(type) {
  150. if (type == "statusstate") {
  151. this.listActivityStaus.forEach((item) => (item.IsChoose = false));
  152. this.activityTimeList.forEach((key) => {
  153. key.IsChoose = false;
  154. });
  155. this.listActivityStaus[0].IsChoose = true;
  156. this.activeState = "1";
  157. this.activityTimeStatus = "";
  158. this.activeStateName = "未开始";
  159. } else if (type == "industry") {
  160. this.listChartPermission = this.listChartPermissionInit;
  161. this.chartPermissionIds = "";
  162. this.isShowJurisdiction = false;
  163. this.isId = 2;
  164. this.listChartPermission.map((item) => (item.IsChoose = false));
  165. this.chartPermissionName = "所有行业";
  166. } else {
  167. this.listActivityType.forEach((item) => (item.IsChoose = false));
  168. this.activityTypeIds = "";
  169. this.activityTypeName = "所有类型";
  170. }
  171. },
  172. //状态的下拉选择
  173. overallBtn(type, item) {
  174. this.listActivityStaus.forEach((key) => {
  175. if (key.Id == item.Id) {
  176. key.IsChoose = !key.IsChoose;
  177. }
  178. });
  179. },
  180. // 行业的下拉选择
  181. overallClick(type, item) {
  182. if (this.isShowJurisdiction) return;
  183. this.listChartPermission.forEach((key) => {
  184. if (key.ChartPermissionId == item.ChartPermissionId) {
  185. key.IsChoose = !key.IsChoose;
  186. }
  187. });
  188. },
  189. //类型的下拉选择
  190. overallActivity(type, item) {
  191. this.listActivityType.forEach((key) => {
  192. if (key.ActivityTypeId == item.ActivityTypeId) {
  193. key.IsChoose = !key.IsChoose;
  194. }
  195. });
  196. },
  197. // 跳转判断权限
  198. // public(type, flag, purl, price = "") {
  199. // this.$store.dispatch("checkHandle", type).then((res) => {
  200. // app.globalData.isAuth = res.IsAuth;
  201. // app.globalData.isBind = res.IsBind;
  202. // if (!res.IsAuth && !res.IsBind) {
  203. // //已授权已绑定
  204. // if (flag) {
  205. // uni.navigateTo({
  206. // url: purl + price,
  207. // });
  208. // }
  209. // } else if (res.IsAuth) {
  210. // //未授权
  211. // uni.navigateTo({
  212. // url: "/pageMy/authGuide/authGuide",
  213. // });
  214. // } else if (res.IsBind && !res.IsAuth) {
  215. // //已授权未绑定
  216. // uni.navigateTo({
  217. // url: "/pageMy/login/login",
  218. // });
  219. // }
  220. // });
  221. // },
  222. //今日,明日 活动的选择
  223. timeListBtn(type, item) {
  224. this.activityTimeList.forEach((key) => {
  225. if (key.Id == item.Id) {
  226. key.IsChoose = !key.IsChoose;
  227. }
  228. });
  229. },
  230. // strictSelection (){
  231. // activity.descriptionOfResearch().then(res=>{
  232. // if(res.Ret==200){
  233. // this.$util.modalShow('',res.Data.Item.ConfigValue,'知道了',()=>{
  234. // })
  235. // }
  236. // })
  237. // }
  238. },
  239. };