index.vue 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841
  1. <template>
  2. <!-- 广告服务 -->
  3. <div>
  4. <!-- 广告页面头部 -->
  5. <AdvertisingHead></AdvertisingHead>
  6. <div class="advertising">
  7. <div class="inner">
  8. <!-- 左侧tab导航 -->
  9. <ul class="nav">
  10. <li class="current" @click="goBuyAd">广告购买</li>
  11. <li @click="goOrderList">工单列表</li>
  12. </ul>
  13. <!-- 广告购买 -->
  14. <div id="buyAd" v-show="adCurrent">
  15. <!-- <AdvertisingBuyAD></AdvertisingBuyAD> -->
  16. <div class="buyAD">
  17. <div class="inner">
  18. <!-- tab栏标题 -->
  19. <div class="tabTitle">
  20. <span class="title">
  21. <span class="number">1</span>
  22. 填写广告信息
  23. </span>
  24. <span class="title">
  25. <span class="icon">
  26. <el-icon>
  27. <DArrowRight />
  28. </el-icon>
  29. </span>
  30. <span class="number">2</span>
  31. 选择相应网站
  32. </span>
  33. <span class="title">
  34. <span class="icon">
  35. <el-icon>
  36. <DArrowRight />
  37. </el-icon>
  38. </span>
  39. <span class="number">3</span>
  40. 提交工单信息
  41. </span>
  42. </div>
  43. <!-- 填写广告信息内容 -->
  44. <div class="textOne" v-show="ad == 1">
  45. <p>
  46. <label for="adName">广告名称:</label>
  47. <el-input id="adName" v-model="adName" style="width: 980px;height: 44px;"
  48. placeholder="请输入广告名称" />
  49. <span v-show="!adName">请输入广告名称。</span>
  50. </p>
  51. <p>
  52. <label for="adLink">广告链接:</label>
  53. <el-input class="adLink" v-model="adLink" style="width: 980px;height: 44px;"
  54. placeholder="请输入广告链接" />
  55. <span v-show="!adLink">请输入广告链接。</span>
  56. </p>
  57. <p>
  58. <label>广告持续时间:</label>
  59. <el-date-picker v-model="startTime" type="date" placeholder="请选择开始时间"
  60. @change=changeStartTime :size="size" />
  61. <strong>至</strong>
  62. <el-date-picker v-model="endTime" type="date" placeholder="请选择结束时间"
  63. @change=changeEndTime :size="size" />
  64. <span v-show="!endTime">请选择广告开始时间和结束时间</span>
  65. </p>
  66. <p class="AdSize">
  67. <label>广告尺寸:</label>
  68. <el-radio-group v-model="adSize" :size="size">
  69. <el-radio :value="1"> 1200 x 90px </el-radio>
  70. <el-radio :value="2"> 420 x 560px </el-radio>
  71. </el-radio-group>
  72. <span v-show="!adSize">请选择广告尺寸。</span>
  73. </p>
  74. <p>
  75. <label>广告图:</label>
  76. <el-upload class="upload-demo" action="http://192.168.1.118:9501"
  77. :on-success="handleUploadSuccess" :on-error="handleUploadError" drag multiple>
  78. <el-icon class="el-icon--upload">
  79. <Plus />
  80. </el-icon>
  81. <div class="el-upload__text">
  82. 选择图片
  83. </div>
  84. </el-upload>
  85. <span>请添加广告图,不大于500k。</span>
  86. </p>
  87. </div>
  88. <!-- 选择相应网站的内容 -->
  89. <div class="textTwo" v-show="ad == 2">
  90. <div class="inner">
  91. <!-- 搜索部分 -->
  92. <div class="pageTop">
  93. <div class="left">
  94. 网站:
  95. <el-select v-model="value" placeholder="请选择网站名称" size="large"
  96. style="width: 244px;height: 44px;">
  97. <el-option v-for="item in options" :key="item.value" :label="item.label"
  98. :value="item.value" />
  99. </el-select>
  100. <a href="#">查看示意图</a>
  101. </div>
  102. <div class="right">
  103. <button class="reset">重置</button>
  104. <button class="search">搜索</button>
  105. </div>
  106. </div>
  107. <!-- 表格部分 -->
  108. <div class="pageTable">
  109. <el-table :data="processedData" border @selection-change="handleSelectionChange"
  110. select-on-indeterminate style="width: 100%"
  111. :header-row-style="{ height: '60px' }" :row-style="{ height: '74px' }"
  112. :header-cell-style="{ backgroundColor: '#fafafa', color: '#666' }">
  113. <el-table-column type="selection" width="152" align="center" />
  114. <el-table-column prop="website_name" label="网站" width="240" />
  115. <el-table-column prop="name" label="广告位名称" width="240" />
  116. <el-table-column prop="combinedField" label="广告尺寸" width="268" />
  117. <el-table-column prop="price" label="金额 (元) / 天" />
  118. </el-table>
  119. </div>
  120. <!-- 页码部分 -->
  121. <div class="pagination">
  122. <HomePagination></HomePagination>
  123. </div>
  124. </div>
  125. </div>
  126. <!-- 提交工单信息 -->
  127. <div class="submit" v-show="ad == 3">
  128. <div class="inner">
  129. <h1>广告信息已提交成功,请等待审核......</h1>
  130. <p>
  131. 工单编号:
  132. <span>{{ orderInformation.$ordernum }}</span>
  133. </p>
  134. <div class="btn">
  135. <button class="check">查看工单</button>
  136. <button class="apply">再次申请</button>
  137. </div>
  138. <span>如有疑问,可联系客服人员。</span>
  139. </div>
  140. </div>
  141. </div>
  142. </div>
  143. </div>
  144. <!-- 工单列表 -->
  145. <div id="orderList" v-show="!adCurrent">
  146. <AdvertisingOrderList></AdvertisingOrderList>
  147. </div>
  148. </div>
  149. <div class="bottom" v-show="ad != 3 && adCurrent">
  150. <div class="inner">
  151. <!-- 总金额 -->
  152. <div class="amount" v-show="ad == 2">
  153. 总金额:
  154. <span>243,210,910</span>
  155. </div>
  156. <!-- 按钮 -->
  157. <button class="btn" @click="nextStep">{{ ad == 1 ? '下一步' : '提交工单' }}</button>
  158. </div>
  159. </div>
  160. </div>
  161. <!-- 广告页面底部 -->
  162. <AdvertisingFoot></AdvertisingFoot>
  163. </div>
  164. </template>
  165. <script setup>
  166. import { ref, onMounted, computed } from 'vue'
  167. import { ElRadioGroup, ElRadio, ElDatePicker, ElInput, ElUpload, ElIcon, ElSelect, ElOption, ElTable, ElTableColumn } from 'element-plus'
  168. import { Plus, DArrowRight } from '@element-plus/icons-vue'
  169. // axios请求
  170. const nuxtApp = useNuxtApp();
  171. const axios = nuxtApp.$axios;
  172. // 通过变量ad控制tab栏标题的颜色及每一步下的不同的内容
  173. let ad = useState("ad", () => 1)
  174. let adCurrent = useState("adCurrent", () => true)
  175. const size = ref < 'default' | 'large' | 'small' > ('default')
  176. let adName = useState("adName", () => "")
  177. let adLink = useState("adLink", () => "")
  178. let startTime = useState("startTime", () => "")
  179. let endTime = useState("endTime", () => "")
  180. let adSize = useState("adSize", () => 1)
  181. let adWidth = useState("adWidth", () => 1200)
  182. let adHeight = useState("adHeight", () => 90)
  183. let pageSize = useState("pageSize", () => 10)
  184. let page = useState("page", () => 1)
  185. let tableData = useState("tableData", () => [])
  186. let processedData = useState("processedData", () => [])
  187. let pids = useState("pids", () => "")
  188. let orderInformation = useState("orderInformation", () => "")
  189. // let order = useState('order', () => "")
  190. // let order_ad = useState('order_ad', () => "")
  191. // 获取开始时间
  192. let changeStartTime = (val) => {
  193. startTime.value = `${val.getFullYear()}-${val.getMonth() + 1}-${val.getDate()}`
  194. console.log(startTime.value);
  195. }
  196. // 获取结束时间
  197. let changeEndTime = (val) => {
  198. endTime.value = `${val.getFullYear()}-${val.getMonth() + 1}-${val.getDate()}`
  199. console.log(endTime.value);
  200. }
  201. //获取图片地址
  202. let handleUploadSuccess = (response, file, fileList) => {
  203. // 假设服务器返回的响应中包含文件地址
  204. console.log(file.name);
  205. const fileUrl = response.fileUrl;
  206. // console.log('上传成功,文件地址为:', fileUrl);
  207. }
  208. //选择的广告位
  209. let handleSelectionChange = (selectedRows) => {
  210. let selectedpids = [];
  211. selectedRows.forEach(row => {
  212. selectedpids.push(row.pid);
  213. });
  214. // console.log('选中行的 pid:', selectedpids);
  215. pids.value = selectedpids.join(",")
  216. // console.log(pids.value);
  217. }
  218. // 点击下一步与提交工单按钮
  219. let nextStep = () => {
  220. ad.value++
  221. let icon = document.querySelectorAll(".icon")
  222. let number = document.querySelectorAll(".number")
  223. let title = document.querySelectorAll(".title")
  224. // 获取广告位需要传递的参数
  225. let adData = {
  226. width: adWidth.value,
  227. height: adHeight.value,
  228. starttime: startTime.value,
  229. endtime: endTime.value,
  230. pageSize: pageSize.value,
  231. page: page.value
  232. }
  233. // 获取广告位需要传递的参数
  234. let orderData = {
  235. name: adName.value,
  236. width: adWidth.value,
  237. height: adHeight.value,
  238. starttime: startTime.value,
  239. endtime: endTime.value,
  240. imgurl: adLink.value,
  241. imgsrc: "11111",
  242. pid: pids.value
  243. }
  244. // 点击下一步
  245. if (ad.value == 2) {
  246. icon[0].classList.add('color')
  247. number[1].classList.add('bgc')
  248. title[1].classList.add('color')
  249. if (adSize.value != 1) {
  250. adWidth.value = 420
  251. adHeight.value = 520
  252. }
  253. //获取广告位
  254. axios.post("/order/getAD", adData).then(response => {
  255. console.log("广告位信息", response.data.rows);
  256. tableData.value = response.data.rows
  257. processedData.value = tableData.value.map(item => {
  258. return {
  259. ...item,
  260. combinedField: `${item.width} x ${item.height} px`,
  261. };
  262. });
  263. }).catch(error => {
  264. console.log(error);
  265. })
  266. }
  267. // 点击提交工单信息
  268. if (ad.value >= 3) {
  269. ad.value = 3
  270. icon[1].classList.add('color')
  271. number[2].classList.add('bgc')
  272. title[2].classList.add('color')
  273. //提交工单
  274. axios.post("/order/addAD", orderData).then(response => {
  275. console.log(response.data);
  276. // tableData.value = response.data.rows
  277. orderInformation.value = response.data
  278. }).catch(error => {
  279. console.log(error);
  280. })
  281. }
  282. }
  283. // 点击广告购买标签的事件驱动函数
  284. let goBuyAd = () => {
  285. adCurrent.value = true
  286. let lis = document.querySelectorAll('.nav>li')
  287. lis[0].classList.add('current')
  288. lis[1].classList.remove('current')
  289. }
  290. // 点击工单列表标签的事件驱动函数
  291. let goOrderList = () => {
  292. adCurrent.value = false
  293. let lis = document.querySelectorAll('.nav>li')
  294. lis[0].classList.remove('current')
  295. lis[1].classList.add('current')
  296. }
  297. const value = ref('')
  298. const options = [
  299. {
  300. value: 'Option1',
  301. label: 'Option1',
  302. },
  303. {
  304. value: 'Option2',
  305. label: 'Option2',
  306. },
  307. {
  308. value: 'Option3',
  309. label: 'Option3',
  310. },
  311. {
  312. value: 'Option4',
  313. label: 'Option4',
  314. },
  315. {
  316. value: 'Option5',
  317. label: 'Option5',
  318. },
  319. ]
  320. </script>
  321. <style lang="less" scoped>
  322. .advertising {
  323. width: 100%;
  324. overflow: hidden;
  325. .inner {
  326. width: 1520px;
  327. // height: 900px;
  328. overflow: hidden;
  329. position: relative;
  330. // 左侧tab导航
  331. .nav {
  332. width: 120px;
  333. height: 80px;
  334. position: absolute;
  335. top: 54px;
  336. left: 0;
  337. border-right: 1px solid #d9d9d9;
  338. >li {
  339. width: 120px;
  340. height: 30px;
  341. font-family: Microsoft YaHei, Microsoft YaHei;
  342. font-weight: 400;
  343. font-size: 20px;
  344. color: #333333;
  345. line-height: 26px;
  346. text-align: left;
  347. font-style: normal;
  348. text-transform: none;
  349. margin-bottom: 20px;
  350. }
  351. .current {
  352. font-weight: bold;
  353. color: #333;
  354. border-right: 2px solid #139602;
  355. }
  356. // >li:hover {
  357. // font-weight: bold;
  358. // color: #333;
  359. // border-right: 2px solid #139602;
  360. // }
  361. }
  362. // 广告购买
  363. #buyAd {
  364. width: 1200px;
  365. margin: 0 auto;
  366. .buyAD {
  367. width: 1200px;
  368. overflow: hidden;
  369. .inner {
  370. width: 1200px;
  371. overflow: hidden;
  372. position: relative;
  373. // 填写信息页tab标题
  374. .tabTitle {
  375. width: 1100px;
  376. height: 80px;
  377. padding-top: 26px;
  378. margin: 0 auto;
  379. box-sizing: border-box;
  380. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  381. .icon,
  382. .title {
  383. font-family: Microsoft YaHei, Microsoft YaHei;
  384. font-weight: bold;
  385. font-size: 16px;
  386. color: #D5D5D5;
  387. text-align: center;
  388. font-style: normal;
  389. text-transform: none;
  390. }
  391. .number {
  392. display: inline-block;
  393. width: 32px;
  394. height: 32px;
  395. line-height: 32px;
  396. color: #ffffff;
  397. background-color: #d5d5d5;
  398. border-radius: 50%;
  399. }
  400. .bgc {
  401. background-color: #139602;
  402. }
  403. .color {
  404. color: #139602;
  405. }
  406. // 填写广告信息字体及背景颜色
  407. .title:first-child {
  408. color: #139602;
  409. }
  410. .title:first-child .number {
  411. background-color: #139602;
  412. }
  413. // 图标>>
  414. .icon {
  415. padding: 0 165px;
  416. }
  417. }
  418. // 1.填写信息内容
  419. .textOne {
  420. width: 1100px;
  421. height: 515px;
  422. margin-top: 30px;
  423. margin-left: 50px;
  424. /deep/.el-radio-group {
  425. height: 55px;
  426. }
  427. >p {
  428. width: 1110px;
  429. height: 75px;
  430. strong {
  431. font-weight: 500;
  432. color: #333333;
  433. padding: 0 14px;
  434. }
  435. label {
  436. display: inline-block;
  437. width: 125px;
  438. text-align: right;
  439. padding-right: 10px;
  440. box-sizing: border-box;
  441. font-family: Microsoft YaHei, Microsoft YaHei;
  442. font-weight: 400;
  443. font-size: 16px;
  444. color: #333333;
  445. line-height: 19px;
  446. font-style: normal;
  447. text-transform: none;
  448. }
  449. >label::before {
  450. content: "*";
  451. display: inline-block;
  452. width: 10px;
  453. height: 2px;
  454. color: #fe0101;
  455. }
  456. span {
  457. color: #fe0101;
  458. display: block;
  459. padding-left: 135px;
  460. height: 30px;
  461. }
  462. .upload-demo {
  463. display: inline-block;
  464. width: 112px;
  465. height: 112px;
  466. vertical-align: -93px;
  467. }
  468. /deep/.el-input__wrapper.is-focus {
  469. box-shadow: 0 0 0 1px #c0c4cc;
  470. }
  471. /deep/.el-date-editor.el-input,
  472. .el-date-editor.el-input__wrapper {
  473. height: 44px;
  474. width: 470px;
  475. }
  476. /deep/.el-input__inner {
  477. font-size: 16px;
  478. }
  479. /deep/.el-upload-dragger {
  480. padding: 0;
  481. margin: 0;
  482. border: 1px solid #ededed;
  483. }
  484. /deep/.el-upload-dragger .el-icon--upload {
  485. font-size: 67px;
  486. line-height: 50px;
  487. padding: 0;
  488. margin: 0;
  489. }
  490. /deep/.el-upload-dragger .el-upload__text {
  491. font-size: 18px;
  492. font-weight: 400;
  493. color: #999;
  494. text-align: center;
  495. margin-bottom: 14px;
  496. margin-top: 5px;
  497. }
  498. /deep/.el-icon svg {
  499. width: 34px;
  500. height: 34px;
  501. }
  502. }
  503. }
  504. // 2.选择相应网站
  505. .textTwo {
  506. width: 1200px;
  507. overflow: hidden;
  508. // 页面头部搜索和按钮
  509. .pageTop {
  510. width: 1150px;
  511. height: 44px;
  512. margin: 30px 0 40px 50px;
  513. >.left {
  514. font-family: Microsoft YaHei, Microsoft YaHei;
  515. font-weight: 400;
  516. font-size: 16px;
  517. color: #333333;
  518. line-height: 19px;
  519. >a {
  520. width: 80px;
  521. height: 21px;
  522. padding-left: 30px;
  523. font-family: Microsoft YaHei, Microsoft YaHei;
  524. font-weight: 400;
  525. font-size: 16px;
  526. color: #47ACFF;
  527. line-height: 19px;
  528. text-align: left;
  529. font-style: normal;
  530. text-transform: none;
  531. }
  532. /deep/.el-select__wrapper.is-focused {
  533. box-shadow: 0 0 0 1px var(--el-border-color) inset;
  534. }
  535. }
  536. >.right {
  537. button {
  538. width: 94px;
  539. height: 36px;
  540. line-height: 36px;
  541. font-family: Microsoft YaHei, Microsoft YaHei;
  542. font-weight: 400;
  543. font-size: 16px;
  544. color: #33B023;
  545. line-height: 19px;
  546. text-align: center;
  547. border: none;
  548. border-radius: 7px;
  549. }
  550. .reset {
  551. border: 1px solid #33B023;
  552. color: #33B023;
  553. background-color: #fff;
  554. margin-right: 25px;
  555. }
  556. .search {
  557. background-color: #33B023;
  558. color: #ffffff;
  559. }
  560. }
  561. }
  562. // 页面中的表格
  563. .pageTable {
  564. width: 100%;
  565. overflow: hidden;
  566. padding-bottom: 60px;
  567. /deep/.el-checkbox__input.is-checked .el-checkbox__inner {
  568. background-color: #333;
  569. border-color: #333;
  570. }
  571. /deep/.el-table tr {
  572. background-color: #fafafa;
  573. height: 74px;
  574. }
  575. /deep/.el-table .cell {
  576. text-align: center;
  577. box-sizing: border-box;
  578. height: 23px;
  579. line-height: 23px;
  580. overflow-wrap: break-word;
  581. padding: 0 12px;
  582. text-overflow: ellipsis;
  583. white-space: normal;
  584. font-family: Microsoft YaHei, Microsoft YaHei;
  585. font-weight: 400;
  586. font-size: 16px;
  587. color: #333333;
  588. line-height: 19px;
  589. font-style: normal;
  590. text-transform: none;
  591. }
  592. }
  593. // 页码
  594. .pagination {
  595. height: 34px;
  596. text-align: center;
  597. padding-bottom: 90px;
  598. }
  599. }
  600. // 3.提交工单信息
  601. .submit {
  602. width: 1200px;
  603. overflow: hidden;
  604. text-align: center;
  605. .inner {
  606. width: 1100px;
  607. padding-left: 50px;
  608. padding-bottom: 130px;
  609. font-family: Microsoft YaHei, Microsoft YaHei;
  610. font-style: normal;
  611. text-transform: none;
  612. // 标题
  613. >h1 {
  614. margin-top: 80px;
  615. margin-bottom: 30px;
  616. font-weight: bold;
  617. font-size: 26px;
  618. color: #333333;
  619. line-height: 30px;
  620. text-align: center;
  621. }
  622. // 工单编号
  623. >p {
  624. margin-bottom: 257px;
  625. font-weight: 400;
  626. font-size: 22px;
  627. color: #333333;
  628. text-align: center;
  629. }
  630. // 按钮
  631. >.btn {
  632. margin-bottom: 30px;
  633. button {
  634. width: 134px;
  635. height: 50px;
  636. border: none;
  637. font-weight: 400;
  638. font-size: 16px;
  639. text-align: center;
  640. border-radius: 7px;
  641. }
  642. .check {
  643. background-color: #fff;
  644. color: #33B023;
  645. border: 1px solid #33B023;
  646. margin-right: 160px;
  647. }
  648. .apply {
  649. background-color: #33B023;
  650. color: #fff;
  651. }
  652. }
  653. // 提示文字
  654. >span {
  655. font-weight: 400;
  656. font-size: 14px;
  657. color: #999999;
  658. }
  659. }
  660. }
  661. }
  662. }
  663. }
  664. //工单列表
  665. #orderList {
  666. width: 1200px;
  667. margin: 0 auto;
  668. }
  669. }
  670. //广告页面底部部分
  671. .bottom {
  672. width: 100%;
  673. height: 145px;
  674. background-color: #ecf5ee;
  675. // display: none;
  676. .inner {
  677. width: 1200px;
  678. height: 145px;
  679. padding: 0;
  680. .amount {
  681. float: left;
  682. padding-top: 52px;
  683. font-family: Microsoft YaHei, Microsoft YaHei;
  684. font-weight: 400;
  685. font-size: 16px;
  686. color: #333333;
  687. line-height: 19px;
  688. text-align: left;
  689. font-style: normal;
  690. text-transform: none;
  691. span {
  692. padding: 0 15px 0 25px;
  693. font-family: Microsoft YaHei, Microsoft YaHei;
  694. font-weight: bold;
  695. font-size: 24px;
  696. color: #028E21;
  697. line-height: 28px;
  698. text-align: left;
  699. font-style: normal;
  700. text-transform: none;
  701. }
  702. }
  703. .btn {
  704. float: right;
  705. width: 115px;
  706. height: 40px;
  707. font-size: 16px;
  708. background-color: #028e21;
  709. color: #ffffff;
  710. border: none;
  711. border-radius: 6px;
  712. margin: 53px 0;
  713. }
  714. }
  715. }
  716. }
  717. </style>