adlist.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587
  1. <template>
  2. <view class="page">
  3. <u-sticky :h5-nav-height="0" z-index="9099" :offset-top='0'>
  4. <uni-NavBar headerTitle="广告列表" background="linear-gradient(230deg, #CFE6FF 40%, #FFFFFF 100%)"
  5. :isSlot="false"></uni-NavBar>
  6. <div class="search dis a-c j-s ">
  7. <u-search v-model="selectedOptions.name" @custom="custom" @search="search" shape="square" :height='68'
  8. color="#AAAAAA" bg-color="#F6F8FC" :input-style="{background:'transparent'}"
  9. :actionStyle="{position: 'absolute',right:'50px',boxSiting:'border-box',borderLeft:'2rpx solid #DDDDDD'}"
  10. placeholder-color="#AAAAAA" :clearabled="true" @clear="clear" placeholder="请输入关键词"></u-search>
  11. <u-icon name="list" class="ml-2" color="#333" size="48" @click="categoryFilterShow=true"></u-icon>
  12. </div>
  13. </u-sticky>
  14. <!-- 广告列表 -->
  15. <view class="adlist dis f-c ">
  16. <view class="dataView dis a-c j-s" v-for="(item,index) in dataList" :key="index" @click="godetails(item)">
  17. <view class="dataView-left dis a-start">
  18. <image src="/static/banner/banner3.jpg" mode=""></image>
  19. <view class="content dis f-c ">
  20. <text class="title">{{item.name}}</text>
  21. <view class="tag dis a-c ">
  22. <text>{{adTypeMap(item.type)}}</text>
  23. <text>{{item.positionName}}</text>
  24. </view>
  25. <view class="dis a-c mb-1">
  26. <view class="time-tag mr-1">始</view>
  27. <text class="time-text"> 开始时间:{{item.startDate}} </text>
  28. </view>
  29. <view class="dis a-c">
  30. <view class="time-tag mr-1" style="background-color: #FF5353;">终</view>
  31. <text class="time-text"> 结束时间:{{item.endDate}} </text>
  32. </view>
  33. </view>
  34. </view>
  35. <view class="dataView-right ">
  36. <text class="status"
  37. :style="{color:statusColorMap(item.status)}">{{statusTypeMap(item.status)}}</text>
  38. <u-icon name="arrow-right" class="ml-1" color="#979797" size="24"></u-icon>
  39. </view>
  40. </view>
  41. </view>
  42. <view class="footer">
  43. <view class="btn dis a-c j-c" @click="createAdShow=true">
  44. <image src="/static/ad/createAd.png" mode="" style="width: 32rpx ; height: 32rpx;margin-right: 13rpx;">
  45. </image>
  46. <text>创建广告</text>
  47. </view>
  48. </view>
  49. <u-popup v-model="createAdShow" mode="center" width="580rpx" :closeable="true" border-radius="20">
  50. <view class="popup">
  51. <view class="header dis a-c j-c ">
  52. <text>选择广告类型</text>
  53. </view>
  54. <view class="createAd-content dis f-wrap j-s">
  55. <view class="adimage dis f-c j-c" v-for="(item,index) in adbgImage" :key="index"
  56. :style="{ backgroundImage: `url('${item.image}')` }" @click="adTypeSelect(item.value)">
  57. <text class="mb-1">{{item.name}}</text>
  58. <text>{{item.content}}</text>
  59. </view>
  60. </view>
  61. </view>
  62. </u-popup>
  63. <u-popup v-model="categoryFilterShow" mode="bottom" :closeable="true" border-radius="20" height="730px">
  64. <view class="popup">
  65. <view class="header dis a-c j-c ">
  66. <text>请选择</text>
  67. </view>
  68. <view class="categoryFilter">
  69. <view class="view dis f-c " v-for="(item,index) in categoryFilter" :key="index">
  70. <text class="title">{{item.title}}</text>
  71. <view class="dis f-wrap a-c">
  72. <view class="status-options dis a-c j-c" :class="{ 'active': isActive(item, Filteritem) }"
  73. v-for="(Filteritem,Filterindex) in item.options" :key="Filterindex"
  74. @click="optionsClick(item, Filteritem)">
  75. <text>{{Filteritem.label}}</text>
  76. </view>
  77. </view>
  78. </view>
  79. <view class="view dis f-c ">
  80. <text class="title">投放页面</text>
  81. <view class="dis f-wrap a-c">
  82. <view class="status-options dis a-c j-c"
  83. :class="{'active':selectedOptions.positionId==item.id}"
  84. v-for="(item,index) in adSlotList" :key="index" @click="adSlotOptions(item)">
  85. <text>{{item.positionName}}</text>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="view dis f-c ">
  90. <text class="title">广告日期</text>
  91. <view class="time-select dis a-c j-s" @click="timeChange">
  92. <text class="">{{startTime && endTime ? startTime+" - "+endTime:'请选择' }}</text>
  93. <u-icon name="arrow-right" color="#979797" size="28"></u-icon>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <view class="categoryFilter-footer dis a-c j-s">
  99. <view class="dis a-c j-c" @click="categoryFilterShow=false">
  100. 重置
  101. </view>
  102. <view class="dis a-c j-c" @click="queryType">
  103. 查询
  104. </view>
  105. </view>
  106. </u-popup>
  107. <my-date-picker ref="datePicker" @confirmPickDate="confirmPickDate" />
  108. </view>
  109. </template>
  110. <script>
  111. import myDatePicker from '@/components/date-picker.vue';
  112. import uniNavBar from '@/components/uni-NavBar/uni-NavBar.vue'
  113. import {
  114. USER_INFO
  115. } from '@/common/util/constants.js'
  116. export default {
  117. components: {
  118. myDatePicker,
  119. uniNavBar
  120. },
  121. data() {
  122. return {
  123. categoryFilterShow: false, //分类筛选
  124. createAdShow: false, //创建广告弹窗
  125. selectedOptions: {
  126. type: null,
  127. status: null,
  128. positionId: null,
  129. name: "",
  130. startDate: "",
  131. endDate: "",
  132. },
  133. startTime: "",
  134. endTime: "",
  135. adbgImage: [{
  136. name: "全屏广告",
  137. value: "0",
  138. content: "沉浸式覆盖",
  139. image: "../static/ad/adtype1.png"
  140. },
  141. {
  142. name: "轮播广告",
  143. value: "2",
  144. content: "多内容循环展示",
  145. image: "../../static/ad/adtype2.png"
  146. }, {
  147. name: "页面嵌入广告",
  148. value: "3",
  149. content: "自然融入页面",
  150. image: "../../static/ad/adtype3.png"
  151. }, {
  152. name: "弹窗广告",
  153. value: "1",
  154. content: "强提醒触达",
  155. image: "../../static/ad/adtype4.png"
  156. }
  157. ],
  158. categoryFilter: [{
  159. title: "广告类型",
  160. filed: "type",
  161. options: [{
  162. id: 0,
  163. label: "全部",
  164. value: "",
  165. },
  166. {
  167. id: 1,
  168. label: "全屏广告",
  169. value: "0",
  170. },
  171. {
  172. id: 2,
  173. label: "弹窗广告",
  174. value: "1",
  175. },
  176. {
  177. id: 3,
  178. label: "轮播广告",
  179. value: "2",
  180. },
  181. {
  182. id: 4,
  183. label: "嵌入商品列表广告",
  184. value: "3",
  185. },
  186. ]
  187. }, {
  188. title: "状态",
  189. filed: "status",
  190. options: [{
  191. id: 0,
  192. label: "全部",
  193. value: " ",
  194. },
  195. {
  196. id: 1,
  197. label: "待审核",
  198. value: "0",
  199. },
  200. {
  201. id: 2,
  202. label: "审核驳回",
  203. value: "1",
  204. },
  205. {
  206. id: 3,
  207. label: "审核通过",
  208. value: "2",
  209. },
  210. {
  211. id: 4,
  212. label: "未开始",
  213. value: "3",
  214. },
  215. {
  216. id: 5,
  217. label: "已生效",
  218. value: "4"
  219. },
  220. {
  221. id: 6,
  222. label: "已作废",
  223. value: "5",
  224. },
  225. {
  226. id: 7,
  227. label: "已结束",
  228. value: "6",
  229. },
  230. ]
  231. }, ],
  232. dataList: [], //广告列表
  233. userInfo: {},
  234. adSlotList: [], //广告位列表
  235. }
  236. },
  237. onShow() {
  238. this.pageLlist(); //列表接口
  239. this.queryAdSlot(); //查询广告位
  240. },
  241. onLoad() {
  242. this.userInfo = uni.getStorageSync(USER_INFO);
  243. },
  244. methods: {
  245. adSlotOptions(item) {
  246. this.selectedOptions.positionId = item.id;
  247. },
  248. queryAdSlot() {
  249. this.$http.get('/adPosition/queryPageList').then(res => {
  250. if (res.data.code == 200) {
  251. if (res.data.code == 200) {
  252. res.data.result.records.unshift({
  253. id: "",
  254. positionName: "全部"
  255. })
  256. this.adSlotList = res.data.result.records
  257. }
  258. }
  259. })
  260. },
  261. queryType() {
  262. this.pageLlist();
  263. this.categoryFilterShow = false
  264. },
  265. adTypeMap(ele) {
  266. const map = {
  267. 0: '全屏广告',
  268. 1: '弹窗广告',
  269. 2: '轮播广告',
  270. 3: '页面嵌入广告',
  271. }
  272. return map[ele] || ''
  273. },
  274. statusTypeMap(ele) {
  275. const map = {
  276. 0: '待审核',
  277. 1: '审核驳回',
  278. 2: '审核通过',
  279. 3: '未开始',
  280. 4: '已生效',
  281. 5: '已作废',
  282. 6: '已结束',
  283. }
  284. return map[ele] || ''
  285. },
  286. statusColorMap(ele) {
  287. const map = {
  288. 0: '#E68D00',
  289. 1: '#F00000',
  290. 2: '#006DFF',
  291. 3: '#777777',
  292. 4: '#006DFF',
  293. 5: '#0081AB',
  294. 6: '#AF60FF',
  295. }
  296. return map[ele] || ''
  297. },
  298. pageLlist() {
  299. this.$http.get('advert/localAdvertTask/list', {
  300. params: {
  301. pageNo: 1,
  302. pageSize: 10,
  303. adType: "1",
  304. merchantId: this.userInfo.merchantId,
  305. merchantName: this.userInfo.merchantName,
  306. ...this.selectedOptions,
  307. }
  308. }).then(res => {
  309. if (res.data.code == '200') {
  310. this.dataList = res.data.result.records
  311. }
  312. })
  313. },
  314. godetails(item) {
  315. uni.navigateTo({
  316. url: '/pages/adManagement/fullscreenAdDetails?info=' + JSON.stringify(item)
  317. })
  318. },
  319. //回车搜索事件
  320. search(val) {
  321. this.pageLlist();
  322. },
  323. //搜索按钮事件
  324. custom(val) {
  325. this.pageLlist();
  326. },
  327. clear(val) {
  328. this.pageLlist();
  329. },
  330. optionsClick(item, Filteritem) {
  331. if (item.filed) {
  332. this.selectedOptions[item.filed] = Filteritem.value;
  333. }
  334. },
  335. isActive(item, Filteritem) {
  336. return this.selectedOptions[item.filed] === Filteritem.value;
  337. },
  338. timeChange() {
  339. this.$refs.datePicker.open()
  340. },
  341. confirmPickDate(dateStr, dateStr1) {
  342. if (dateStr) {
  343. dateStr += ' 00:00:00'
  344. }
  345. if (dateStr1) {
  346. dateStr1 += ' 23:59:59'
  347. }
  348. this.selectedOptions.startTime = dateStr;
  349. this.selectedOptions.endTime = dateStr1;
  350. },
  351. adTypeSelect(value) {
  352. uni.navigateTo({
  353. url: '/pages/adManagement/createFullscreenAd?adType=' + value
  354. })
  355. this.createAdShow = false
  356. }
  357. }
  358. }
  359. </script>
  360. <style lang="scss" scoped>
  361. .page {
  362. background-color: #F7F8FC;
  363. height: 100vh;
  364. }
  365. .search {
  366. background-color: #fff;
  367. padding: 14rpx 24rpx;
  368. box-sizing: border-box;
  369. border-bottom: 1rpx solid #eee;
  370. image {
  371. width: 36rpx;
  372. height: 36rpx;
  373. }
  374. ::v-deep {
  375. .u-close-wrap {
  376. margin-right: 70rpx;
  377. }
  378. }
  379. }
  380. .dataView {
  381. background: #FFFFFF;
  382. margin-bottom: 20rpx;
  383. padding: 30rpx 24rpx;
  384. box-sizing: border-box;
  385. height: 100%;
  386. .dataView-left {
  387. height: 100%;
  388. flex: 1;
  389. .content {
  390. height: 100%;
  391. .title {
  392. font-size: 30rpx;
  393. font-weight: bold;
  394. color: #000;
  395. margin-bottom: 10rpx;
  396. }
  397. .tag {
  398. margin-bottom: 10rpx;
  399. text {
  400. font-size: 24rpx;
  401. color: #777;
  402. border-right: 1rpx solid #777;
  403. padding-right: 10rpx;
  404. margin-right: 10rpx;
  405. }
  406. text:last-child {
  407. border: none;
  408. }
  409. }
  410. .time-tag {
  411. background-color: #3C96FF;
  412. padding: 3rpx 6rpx;
  413. box-sizing: border-box;
  414. color: #fff;
  415. border-radius: 4rpx;
  416. font-size: 20rpx;
  417. }
  418. .time-text {
  419. font-size: 22rpx;
  420. color: #8F96AC;
  421. }
  422. }
  423. >image {
  424. width: 160rpx;
  425. height: 160rpx;
  426. margin-right: 25rpx;
  427. border-radius: 10rpx;
  428. }
  429. }
  430. .dataView-right {
  431. font-size: 24rpx;
  432. }
  433. }
  434. .footer {
  435. box-sizing: border-box;
  436. padding: 17rpx 24rpx;
  437. position: fixed;
  438. bottom: 0;
  439. left: 0;
  440. right: 0;
  441. background-color: #fff;
  442. .btn {
  443. box-sizing: border-box;
  444. padding: 26rpx;
  445. border-radius: 40rpx;
  446. background-color: #4B9DFF;
  447. font-size: 30rpx;
  448. color: #fff;
  449. }
  450. }
  451. .popup {
  452. padding: 0 20rpx;
  453. box-sizing: border-box;
  454. .header {
  455. padding: 28rpx;
  456. box-sizing: border-box;
  457. font-size: 34rpx;
  458. color: #333;
  459. font-weight: bold;
  460. border-bottom: 1rpx solid #eee;
  461. }
  462. }
  463. .createAd-content {
  464. padding: 30rpx 0;
  465. box-sizing: border-box;
  466. .adimage {
  467. width: 260rpx;
  468. height: 143rpx;
  469. border-radius: 10rpx;
  470. background-size: 100% 100%;
  471. margin-bottom: 20rpx;
  472. padding: 0 20rpx;
  473. text:first-child {
  474. font-size: 26rpx;
  475. color: #333;
  476. }
  477. text:last-child {
  478. font-size: 22rpx;
  479. color: #888;
  480. }
  481. }
  482. }
  483. .categoryFilter {
  484. padding: 30rpx 0;
  485. box-sizing: border-box;
  486. .view {
  487. margin-bottom: 20rpx;
  488. .title {
  489. font-size: 26rpx;
  490. color: #666;
  491. margin-bottom: 32rpx;
  492. }
  493. .status-options {
  494. min-width: 165rpx;
  495. background: #F7F8FC;
  496. border-radius: 5rpx;
  497. margin-bottom: 14rpx;
  498. margin-right: 16rpx;
  499. padding: 26rpx 28rpx;
  500. box-sizing: border-box;
  501. font-size: 28rpx;
  502. color: #333;
  503. border: 1px solid transparent;
  504. }
  505. .active {
  506. background: #ECF5FF;
  507. border: 1px solid #3F99FF;
  508. color: #1476EA;
  509. }
  510. .time-select {
  511. height: 88rpx;
  512. background: #F7F8FC;
  513. border-radius: 5rpx;
  514. padding: 30rpx 24rpx;
  515. box-sizing: border-box;
  516. }
  517. }
  518. }
  519. .categoryFilter-footer {
  520. position: absolute;
  521. bottom: 0;
  522. width: 100%;
  523. padding: 17rpx 24rpx;
  524. box-sizing: border-box;
  525. background: #fff;
  526. box-shadow: 0rpx 0rpx 12rpx 1rpx rgba(225, 225, 225, 0.3);
  527. font-size: 30rpx;
  528. view:first-child {
  529. width: 30%;
  530. background: #FFFFFF;
  531. padding: 27rpx;
  532. box-sizing: border-box;
  533. border-radius: 100px;
  534. border: 1px solid #E5E5E5;
  535. color: #888;
  536. }
  537. view:last-child {
  538. width: 70%;
  539. background: #4B9DFF;
  540. color: #fff;
  541. padding: 27rpx;
  542. box-sizing: border-box;
  543. border-radius: 100px;
  544. margin-left: 24rpx;
  545. }
  546. }
  547. </style>