adlist.vue 13 KB

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