index.vue 55 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564
  1. <template>
  2. <!-- 广告服务 -->
  3. <div>
  4. <!-- 广告页面头部 -->
  5. <!-- <AdvertisingHead></AdvertisingHead> -->
  6. <HomePageHead></HomePageHead>
  7. <HomePageNavigation1></HomePageNavigation1>
  8. <div class="adtips">
  9. <div class="inner">
  10. <p v-if="activeName == '1'">注意:广告购买需提交信息,用户与商务人员进行线下金额交易,交易成功后由商务人员后台审核。审核通过,即广告投放成功。</p>
  11. </div>
  12. </div>
  13. <div class="advertising">
  14. <div class="inner">
  15. <el-tabs v-model="activeName" :tab-position="tabPosition" class="demo-tabs" @tab-change="goOrderList">
  16. <!-- {{ ad }} -->
  17. <el-tab-pane label="广告购买" name="1" @click="goBuyAd">
  18. <!-- 广告购买 -->
  19. <div id="buyAd">
  20. <div class="buyAD">
  21. <div class="inner">
  22. <!-- 填写广告信息内容 -->
  23. <div class="textOne" v-if="ad == 1">
  24. <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="120"
  25. class="demo-ruleForm" :size="formSize" status-icon>
  26. <el-form-item label="广告名称:" prop="adName">
  27. <el-input v-model="ruleForm.adName" placeholder="请输入广告名称" />
  28. </el-form-item>
  29. <el-form-item label="广告链接:" prop="adLink">
  30. <el-input v-model="ruleForm.adLink" placeholder="请输入广告链接" />
  31. </el-form-item>
  32. <el-form-item label="广告持续时间:" required>
  33. <el-config-provider :locale="zhCn">
  34. <el-date-picker v-model="ruleForm.time" type="daterange"
  35. range-separator="至" start-placeholder="请选择开始时间"
  36. end-placeholder="请选择结束时间" :size="size" @change="changeStartTime"
  37. :disabled-date="disabledStartTime" />
  38. </el-config-provider>
  39. </el-form-item>
  40. <el-form-item label="广告尺寸:" prop="adSize">
  41. <el-radio-group v-model="ruleForm.adSize">
  42. <el-radio :value="item.id" v-for="item in options" :key="item.id"
  43. @change="changeAdSize">{{
  44. item.size }}</el-radio>
  45. </el-radio-group>
  46. <!-- <el-select v-model="ruleForm.adSize" placeholder="请选择广告尺寸" @change="changeAdSize">
  47. <el-option v-for="item in options" :key="item.id" :label="item.size"
  48. :value="item.id"></el-option>
  49. </el-select> -->
  50. <a class="pic" @click="goPhoto">查看示意图</a>
  51. </el-form-item>
  52. <!-- 表格部分 -->
  53. <div class="pageTable">
  54. <el-table :data="tableData" border ref="multipleTable" empty-text="暂无数据"
  55. @selection-change="handleSelectionChange" style="width: 100%"
  56. :header-row-style="{ height: '60px' }"
  57. :row-style="{ height: '74px' }"
  58. :header-cell-style="{ backgroundColor: '#fafafa', color: '#666' }">
  59. <!-- <el-table-column type="selection" :reserve-selection="true"
  60. width="152" align="center" /> -->
  61. <el-table-column width="" align="center">
  62. <template #default="{ row }">
  63. <el-checkbox v-model="row.selected"
  64. @change="toggleRowSelection(row)">
  65. </el-checkbox>
  66. </template>
  67. </el-table-column>
  68. <el-table-column prop="website_name" label="网站" width="220" />
  69. <el-table-column prop="name" label="广告位名称" width="320" />
  70. <el-table-column prop="size" label="广告尺寸" width="180" />
  71. <el-table-column prop="price" label="金额 (元) / 天" width="160" />
  72. </el-table>
  73. </div>
  74. <el-form-item label="广告图:" prop="adImg">
  75. <el-upload class="avatar-uploader" action="#" :show-file-list="false"
  76. :on-success="handleAvatarSuccess"
  77. :before-upload="beforeAvatarUpload">
  78. <img v-if="imageUrl" :src="imageUrl" class="avatar" />
  79. <div v-else>
  80. <el-icon class="avatar-uploader-icon">
  81. <Plus></Plus>
  82. <div class="chooseImgDiv">选择图片</div>
  83. </el-icon>
  84. </div>
  85. </el-upload>
  86. </el-form-item>
  87. </el-form>
  88. <!-- 示意图弹框 -->
  89. <el-dialog v-model="dialogTableVisible" :show-close="false" width="60%"
  90. :close-on-click-modal="false">
  91. <template #header="{ close, titleId, titleClass }">
  92. <div class="my-header">
  93. <h4 :id="titleId" :class="titleClass" class="left">示意图类型</h4>
  94. <el-button type="danger" @click="close" class="right">
  95. <el-icon class="el-icon--left">
  96. <CircleCloseFilled />
  97. </el-icon>
  98. 关闭
  99. </el-button>
  100. </div>
  101. </template>
  102. <ul class="graph">
  103. <li>
  104. <span>广告尺寸图A: 1200x90</span>
  105. <img src="../../static/ad/01.png" alt="">
  106. </li>
  107. <li>
  108. <span>广告尺寸图B: 600x150</span>
  109. <img src="../../static/ad/02.png" alt="">
  110. </li>
  111. <li>
  112. <span>广告尺寸图C: 300x150</span>
  113. <img src="../../static//ad/03.png" alt="">
  114. </li>
  115. </ul>
  116. </el-dialog>
  117. </div>
  118. <!-- 提交工单信息 -->
  119. <div class="submit" v-if="ad == 2">
  120. <div class="inner">
  121. <h1>广告信息已提交成功,请等待审核......</h1>
  122. <p>
  123. 工单编号:
  124. <span>{{ orderInformation }}</span>
  125. </p>
  126. <div class="btn">
  127. <button class="check" @click="lookOrder">查看工单</button>
  128. <button class="apply" @click="reapply">再次申请</button>
  129. </div>
  130. <span>如有疑问,可联系客服人员。</span>
  131. </div>
  132. </div>
  133. </div>
  134. </div>
  135. </div>
  136. </el-tab-pane>
  137. <el-tab-pane label="工单列表" name="2">
  138. <!-- 工单列表 -->
  139. <AdvertisingOrderList @childData="handleChildData"></AdvertisingOrderList>
  140. </el-tab-pane>
  141. </el-tabs>
  142. </div>
  143. <div class="bottom" v-if="ad == 1 && activeName == '1'" :key="ad">
  144. <div class="inner">
  145. <!-- 总金额 -->
  146. <div class="amount" v-if="ad == 1">
  147. 总金额:
  148. <span>{{ priceTotal == '' ? 0 : priceTotal }}</span>
  149. </div>
  150. <!-- 按钮 -->
  151. <div class="btn">
  152. <button class="btn2" @click="submitStep" v-if="ad == 1"> 提交工单</button>
  153. </div>
  154. </div>
  155. </div>
  156. </div>
  157. <!-- 广告页面底部 -->
  158. <HomeFoot1></HomeFoot1>
  159. </div>
  160. </template>
  161. <script setup>
  162. import { ref, onMounted, watch, reactive } from 'vue'
  163. // import { ElCheckbox, ElRadio, ElRadioGroup, ElDatePicker, ElInput, ElUpload, ElPagination, ElIcon, ElSelect, ElOption, ElTabs, ElTabPane, ElTable, ElTableColumn, ElMessage, ElForm, ElFormItem, ElCol, valueEquals } from 'element-plus'
  164. import { ElCheckbox, ElRadio, ElRadioGroup, ElDatePicker, ElInput, ElUpload, ElPagination, ElIcon, ElSelect, ElOption, ElTabs, ElTabPane, ElTable, ElTableColumn, ElMessage, ElForm, ElFormItem, ElCol, valueEquals, ElConfigProvider } from 'element-plus'
  165. import { ElButton, ElDialog } from 'element-plus'
  166. import { CircleCloseFilled } from '@element-plus/icons-vue'
  167. import { Plus, DArrowRight, Edit, Picture, UploadFilled } from '@element-plus/icons-vue'
  168. import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
  169. import { getToken, setToken, removeToken } from '@/store/useCookieStore'
  170. import { useRoute } from 'vue-router'
  171. const route = useRoute()
  172. // axios请求
  173. const nuxtApp = useNuxtApp();
  174. const axios = nuxtApp.$axios;
  175. // 通过变量ad控制tab栏标题的颜色及每一步下的不同的内容
  176. let ad = useState("ad", () => 1)
  177. let dialogTableVisible = useState("dialogTableVisible", () => false)//示意图弹框
  178. let dialogTableVisible1 = useState("dialogTableVisible1", () => false)//示意图弹框
  179. let activeName = useState("activeName", () => "1")
  180. let startTime = useState("startTime", () => new Date())
  181. let adSize = useState("adSize", () => "")
  182. let tableData = useState("tableData", () => [])
  183. let processedData = useState("processedData", () => [])
  184. let pid = useState("pid", () => [])
  185. let pids = useState("pids", () => [])
  186. let pidArr = useState("pidArr", () => [])
  187. let orderInformation = useState("orderInformation", () => "")
  188. let adWeb = useState("adWeb", () => "")
  189. let adWebId = useState("adWebId", () => "")
  190. let adWebList = useState("adWebList", () => [])
  191. let priceTotal = useState("priceTotal", () => '')//总金额
  192. let orderId = useState("orderId", () => "")
  193. let options = useState('options', () => [])
  194. const multipleTable = ref('');
  195. let shopCode = useState('shopCode', () => '')
  196. let token = useState('token', () => '')
  197. let showToken = useState("showToken", () => '')
  198. watch(token, (newval, oldval) => {
  199. console.log(newval, oldval);
  200. showToken.value = newval
  201. }, {
  202. deep: true,
  203. immediate: true,
  204. })
  205. // 定义响应式数据
  206. const seoData = ref({
  207. title: '广告服务',
  208. description: '默认描述',
  209. keywords: '默认关键词',
  210. image: 'https://example.com/default-image.jpg'
  211. });
  212. // 在 onMounted 钩子中获取数据
  213. onMounted(()=>{
  214. seoData.value.title = '广告服务';
  215. seoData.value.description = '默认描述';
  216. seoData.value.keywords = '默认关键词';
  217. })
  218. let goTopic = () => {
  219. navigateTo({
  220. path: "/topic"
  221. })
  222. }
  223. let goAD = () => {
  224. navigateTo({
  225. path: "/advertising"
  226. })
  227. }
  228. let goLogin = () => {
  229. token.value = getToken()
  230. // window.location.href = ("http://adminpre.bjzxtw.org.cn/#/login?backurl=http%3a%2f%2fnwdev.bjzxtw.org.cn%2f")
  231. window.location.href = ("http://adminpre.bjzxtw.org.cn/auth/login.php?backurl=http://nwpre.bjzxtw.org.cn")
  232. token.value = getToken()
  233. }
  234. let goReg = () => {
  235. dialogTableVisible1.value = true
  236. }
  237. let goUserInfo = () => {
  238. }
  239. // 分页
  240. let total = useState('total', () => 0)
  241. let pageSize = useState("pageSize", () => 20)
  242. let page = useState("page", () => 1)
  243. //ruleForm
  244. let logoUrl = ref('');
  245. const formSize = ref('default');
  246. const ruleFormRef = ref();
  247. const ruleForm = reactive({
  248. adName: '',
  249. adLink: '',
  250. time: '',
  251. startTime: '',
  252. endTime: '',
  253. adSize: 1,
  254. adImg: '',
  255. });
  256. const rules = reactive({
  257. adName: [{ required: true, message: '请输入广告名称', trigger: 'blur' }],
  258. adLink: [{ required: true, message: '请输入广告链接', trigger: 'change' }],
  259. startTime: [{ required: true, message: '请输入开始时间', trigger: 'change' }],
  260. endTime: [{ required: true, message: '请输入结束时间', trigger: 'change' }],
  261. adSize: [{ required: true, message: '请选择广告尺寸', trigger: 'change' }],
  262. adImg: [{ required: true, message: '请选择广告图', trigger: 'change' }],
  263. });
  264. const tabPosition = ref('left')
  265. // 获取开始时间
  266. let changeStartTime = (val) => {
  267. console.log(val);
  268. ruleForm.startTime = `${val[0].getFullYear()}-${val[0].getMonth() + 1}-${val[0].getDate()}`
  269. ruleForm.endTime = `${val[1].getFullYear()}-${val[1].getMonth() + 1}-${val[1].getDate()}`
  270. console.log(ruleForm.startTime);
  271. console.log(ruleForm.endTime);
  272. getAdSize()
  273. //创建购物车
  274. axios.post("/order/addShoppingCart").then(response => {
  275. // console.log("创建购物车", response.data);
  276. shopCode.value = response.data
  277. console.log('shopCode', shopCode.value);
  278. })
  279. }
  280. //禁止选择的时间区域
  281. let disabledStartTime = (time) => {
  282. return time.getTime() <= (Date.now() + 3600 * 1000 * 24);
  283. }
  284. const imageUrl = ref('');
  285. const handleAvatarSuccess = (response, uploadFile) => {
  286. imageUrl.value = URL.createObjectURL(uploadFile.raw);
  287. };
  288. const bb = (item) => {
  289. console.log("===", item)
  290. navigateTo({
  291. path: "/advertising/addetail",
  292. query: {
  293. id: item
  294. }
  295. })
  296. }
  297. //获取图片地址
  298. const beforeAvatarUpload = (file) => {
  299. console.log('file', file);
  300. if (!file) return;
  301. const isJPG = file.type === 'image/jpeg';
  302. const isPNG = file.type === 'image/png';
  303. const isLt2M = file.size / 1024 / 1024 < 2;
  304. if (!isJPG && !isPNG) {
  305. ElMessage.error('上传图片只能是 JPG 或 PNG 格式!');
  306. return;
  307. }
  308. if (!isLt2M) {
  309. ElMessage.error('上传图片大小不能超过 2MB!');
  310. return;
  311. }
  312. const data = new FormData();
  313. data.append('file', file);
  314. axios.post("/public/uploadFile", data).then(res => {
  315. console.log(res);
  316. logoUrl.value = res.data.imgUrl;
  317. ruleForm.adImg = res.data.imgUrl;
  318. }).catch(() => {
  319. ElMessage({
  320. type: 'info',
  321. message: '网络错误,请重试!'
  322. });
  323. });
  324. };
  325. let goPhoto = () => {
  326. dialogTableVisible.value = true
  327. }
  328. //选择的广告位
  329. let handleSelectionChange = (selectedRows) => {
  330. pidArr.value = selectedRows.map(row => row.pid);
  331. console.log("选中的广告位llllllllll", pidArr.value);
  332. // getPrice() //获取总金额
  333. let aa = JSON.parse(JSON.stringify(pidArr.value))
  334. console.log("pids", aa);
  335. for (let item = 0; item <= aa.length - 1; item++) {
  336. console.log('pidArr.value', aa[item]);
  337. pids.value = aa[item]
  338. }
  339. }
  340. pidArr.value.forEach((item) => {
  341. const index = tableData.findIndex((row) => row.id === item);
  342. if (index !== -1) {
  343. tableData[index].selected = true;
  344. }
  345. });
  346. let toggleRowSelection = (row) => {
  347. console.log('11111', row.pid);
  348. console.log('类型', typeof (row.pid));
  349. // 判断 row.pid 是否已经存在于 pid.value 数组中
  350. const isExist = pid.value.includes(row.pid);
  351. console.log('判断当前选择的id是否已被选择', isExist); // 输出: true
  352. if (isExist) {
  353. //删除购物车中的广告位
  354. let data = {
  355. shopping_id: shopCode.value,
  356. pid: row.pid,
  357. }
  358. //删除购物车接口
  359. axios.post('/order/delShoppingCartAD', data).then(data => {
  360. console.log('删除购物车广告位--------------', data);
  361. if (data.code == 200) {
  362. getShoppingCartAD()
  363. }
  364. })
  365. } else {
  366. //添加购物车中的广告位
  367. let data = {
  368. shopping_id: shopCode.value,
  369. pid: row.pid,
  370. }
  371. //添加购物车接口
  372. axios.post('/order/addShoppingCartAD', data).then(data => {
  373. console.log('添加购物车广告位--------------', data);
  374. if (data.code == 200) {
  375. getShoppingCartAD()
  376. }
  377. })
  378. }
  379. };
  380. onMounted(() => {
  381. tableData.value.forEach((row) => {
  382. console.log(row);
  383. if (row.selected) {
  384. multipleTable.value.toggleRowSelection(row, true);
  385. }
  386. });
  387. });
  388. //获取广告尺寸列表
  389. let adSizeList = () => {
  390. // 搜索按钮接口
  391. axios.post("/order/getAD").then(response => {
  392. console.log("response", response);
  393. options.value = response.data
  394. for (let item of options.value) {
  395. console.log(item);
  396. item.size = item.width + ' * ' + item.height + ' px '
  397. // ruleForm.adSize = item.id
  398. }
  399. console.log("=========", options.value);
  400. })
  401. }
  402. //查看工单
  403. let lookOrder = () => {
  404. activeName.value = '2'
  405. sessionStorage.setItem('activeName', JSON.stringify('2'));
  406. // window.location.href = (`http://localhost:3000/advertising?activeName=${'2'}`)
  407. window.location.href = (`http://nwpre.bjzxtw.org.cn/advertising?activeName=${'2'}`)
  408. }
  409. //再次申请
  410. let reapply = () => {
  411. ad.value = 1
  412. // window.location.href = ('http://localhost:3000/advertising')
  413. window.location.href = ('http://nwpre.bjzxtw.org.cn/advertising')
  414. }
  415. //获取总金额
  416. const getPrice = () => {
  417. let data = {
  418. starttime: ruleForm.startTime,
  419. endtime: ruleForm.endTime,
  420. pid: pid.value
  421. }
  422. console.log('data=========', data);
  423. axios.post('/order/getPrice', data).then(data => {
  424. console.log('获取到的金额', data.data);
  425. priceTotal.value = data.data
  426. })
  427. }
  428. //获取购物车广告位
  429. const getShoppingCartAD = () => {
  430. axios.post('/order/getShoppingCartAD', {
  431. shopping_id: shopCode.value
  432. }).then(data => {
  433. console.log('获取购物车广告位=====================', data.data.pid);
  434. pid.value = data.data.pid
  435. getPrice()
  436. })
  437. }
  438. //挂载成功
  439. onMounted(() => {
  440. adSizeList()
  441. getPrice()
  442. if (route.query.activeName == '1' || route.query.activeName == '2') {
  443. activeName.value = route.query.activeName;
  444. }
  445. if (!route.query.activeName) {
  446. activeName.value = JSON.parse(sessionStorage.getItem('activeName'));
  447. // console.log('activeName', activeName.value);
  448. }
  449. })
  450. onMounted(() => {
  451. // ad.value=route.query.ad
  452. watch(activeName, (newval) => {
  453. console.log('activeName', newval);
  454. sessionStorage.setItem('activeName', JSON.stringify(newval));
  455. }, {
  456. deep: true,
  457. immediate: true
  458. })
  459. })
  460. //6.子组件传递的数据 start ---------------------------------------->
  461. let handleChildData = (data) => {
  462. activeName.value = `${data}`
  463. }
  464. //6.子组件传递的数据 end ---------------------------------------->
  465. //广告尺寸发生变化的时候
  466. let changeAdSize = (val) => {
  467. console.log('val', val);
  468. ruleForm.adSize = val
  469. getAdSize()
  470. }
  471. //获取广告尺寸
  472. let getAdSize = () => {
  473. // 获取广告位需要传递的参数
  474. let adData = {
  475. ad_size_id: ruleForm.adSize,
  476. starttime: ruleForm.startTime,
  477. endtime: ruleForm.endTime,
  478. pageSize: pageSize.value,
  479. page: page.value,
  480. }
  481. //获取广告位
  482. axios.post("/order/getWebsiteAd", adData).then(response => {
  483. console.log("广告位", response.data);
  484. // console.log("广告位信息", response.data.rows);
  485. total.value = response.data.count
  486. tableData.value = response.data.rows
  487. for (let item of tableData.value) {
  488. item.size = item.size_width + ' * ' + item.size_height + ' px '
  489. item.selected = false
  490. }
  491. console.log('tableData', tableData.value);
  492. }).catch(error => {
  493. console.log(error);
  494. })
  495. }
  496. // 点击提交工单信息
  497. let submitStep = () => {
  498. // 表单验证
  499. if (ruleForm.adName == '') {
  500. ElMessage({
  501. message: '请输入广告名称',
  502. type: 'error',
  503. })
  504. return
  505. }
  506. if (ruleForm.adLink == '') {
  507. ElMessage({
  508. message: '请输入广告链接',
  509. type: 'error',
  510. })
  511. return
  512. }
  513. if (ruleForm.startTime == '') {
  514. ElMessage({
  515. message: '请选择广告持续时间!',
  516. type: 'error',
  517. })
  518. return
  519. }
  520. if (ruleForm.endTime == '') {
  521. ElMessage({
  522. message: '请选择广告尺寸',
  523. type: 'error',
  524. })
  525. return
  526. }
  527. if (ruleForm.adSize == '') {
  528. ElMessage({
  529. message: '请选择广告尺寸',
  530. type: 'error',
  531. })
  532. return
  533. }
  534. if (ruleForm.adImg == '') {
  535. ElMessage({
  536. message: '请添加广告图',
  537. type: 'error',
  538. })
  539. return
  540. }
  541. ad.value++
  542. // 获取广告位需要传递的参数
  543. let orderData = {
  544. name: ruleForm.adName,
  545. ad_size_id: ruleForm.adSize,
  546. starttime: ruleForm.startTime,
  547. endtime: ruleForm.endTime,
  548. imgurl: ruleForm.adLink,
  549. imgsrc: ruleForm.adImg,
  550. pid: pid.value,
  551. price: priceTotal.value
  552. }
  553. //提交工单
  554. axios.post("/order/addAD", orderData).then(response => {
  555. console.log("提交工单", response); //order_id
  556. console.log("orderData", orderData);
  557. if (response.code == 200) {
  558. tableData.value = response.data.rows
  559. orderInformation.value = response.data.ordernum
  560. orderId.value = response.data.order_id
  561. }
  562. }).catch(error => {
  563. console.log(error);
  564. })
  565. }
  566. // // 点击广告购买标签的事件驱动函数
  567. let goBuyAd = () => {
  568. activeName.value = '1'
  569. }
  570. // 点击工单列表标签的事件驱动函数
  571. let goOrderList = (item) => {
  572. if (item == 2 && (route.query.activeName == '1' || route.query.activeName == '2')) {
  573. // window.location.href = ('http://localhost:3000/advertising')
  574. window.location.href = ('http://nwpre.bjzxtw.org.cn/advertising')
  575. }
  576. }
  577. watch(adSize, (newval) => {
  578. // console.log('newval', newval);
  579. adSize.value = newval
  580. }, {
  581. deep: true,
  582. immediate: true
  583. })
  584. watch(ad, (newval) => {
  585. // console.log('adnewval', newval);
  586. adSize.value = newval
  587. }, {
  588. deep: true,
  589. immediate: true
  590. })
  591. </script>
  592. <style lang="less" scoped>
  593. // 广告页面头部
  594. .head {
  595. width: 100%;
  596. padding: 15px 0;
  597. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  598. .inner {
  599. width: 1200px;
  600. height: 27px;
  601. }
  602. .headLogo {
  603. .webName {
  604. display: inline-block;
  605. span {
  606. margin-right: 30px;
  607. font-family: Microsoft YaHei, Microsoft YaHei;
  608. font-weight: 400;
  609. font-size: 12px;
  610. color: #666666;
  611. line-height: 14px;
  612. text-align: left;
  613. font-style: normal;
  614. text-transform: none;
  615. }
  616. }
  617. >span {
  618. display: inline-block;
  619. width: 100px;
  620. padding-left: 25px;
  621. vertical-align: middle;
  622. font-family: Microsoft YaHei, Microsoft YaHei;
  623. font-weight: 400;
  624. font-size: 12px;
  625. color: #333333;
  626. line-height: 21px;
  627. text-align: left;
  628. font-style: normal;
  629. text-transform: none;
  630. border-left: 1px solid #ccc;
  631. }
  632. }
  633. .right {
  634. span {
  635. margin-left: 26px;
  636. font-family: PingFang SC, PingFang SC;
  637. font-weight: 400;
  638. font-size: 12px;
  639. color: #666666;
  640. line-height: 14px;
  641. text-align: left;
  642. font-style: normal;
  643. text-transform: none;
  644. }
  645. .login,
  646. .reg,
  647. .user,
  648. .topic,
  649. .ad {
  650. display: inline-block;
  651. width: 16px;
  652. height: 16px;
  653. vertical-align: -6px;
  654. }
  655. .topic {
  656. background: url("../../static/ad/shopping-mall.png") no-repeat;
  657. }
  658. .ad {
  659. background: url("../../static/ad/ad-product.png") no-repeat;
  660. }
  661. .login {
  662. background: url("../../static/ad/user.png") no-repeat;
  663. }
  664. .reg {
  665. background: url("../../static/ad/write.png") no-repeat;
  666. }
  667. .user {
  668. background: url("../../static/ad/user.png") no-repeat;
  669. }
  670. }
  671. .tips1 {
  672. padding: 20px 0;
  673. text-align: center;
  674. font-size: 20px;
  675. color: #40663B;
  676. font-weight: bold;
  677. img {
  678. width: 78px;
  679. height: 78px;
  680. vertical-align: middle;
  681. margin-right: 20px;
  682. p {
  683. line-height: 30px;
  684. }
  685. }
  686. p {
  687. line-height: 40px;
  688. }
  689. >p:first-child {
  690. margin-bottom: 30px;
  691. }
  692. }
  693. }
  694. //提示信息
  695. .adtips {
  696. width: 100%;
  697. height: 70px;
  698. line-height: 70px;
  699. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  700. .inner {
  701. width: 1200px;
  702. height: 70px;
  703. }
  704. p {
  705. font-family: Microsoft YaHei, Microsoft YaHei;
  706. font-weight: 400;
  707. font-size: 16px;
  708. color: #FE0101;
  709. // line-height: 19px;
  710. text-align: left;
  711. font-style: normal;
  712. text-transform: none;
  713. }
  714. }
  715. .advertising {
  716. width: 100%;
  717. overflow: hidden;
  718. .inner {
  719. width: 1520px;
  720. // height: 900px;
  721. overflow: hidden;
  722. position: relative;
  723. // 左侧tab导航
  724. :deep(.el-tabs--left .el-tabs__header.is-left) {
  725. margin-top: 50px;
  726. margin-right: 10px;
  727. }
  728. // 左侧tab导航字体颜色
  729. :deep(.el-tabs__item.is-active),
  730. :deep(.el-tabs__item:hover) {
  731. color: #139602;
  732. // font-weight: bold;
  733. }
  734. // 左侧tab导航字体大小
  735. :deep(.el-tabs--left .el-tabs__item.is-left) {
  736. text-align: right;
  737. font-size: 20px;
  738. }
  739. // 左侧tab导航下划线
  740. :deep(.el-tabs__active-bar) {
  741. background-color: #139602;
  742. }
  743. // 广告购买
  744. #buyAd {
  745. width: 1200px;
  746. margin: 0 35px;
  747. .buyAD {
  748. width: 1200px;
  749. overflow: hidden;
  750. .inner {
  751. width: 1200px;
  752. overflow: hidden;
  753. position: relative;
  754. // 填写信息页tab标题
  755. .tabTitle {
  756. width: 1100px;
  757. height: 80px;
  758. padding-top: 26px;
  759. margin: 0 auto;
  760. box-sizing: border-box;
  761. border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  762. .icon,
  763. .title {
  764. font-family: Microsoft YaHei, Microsoft YaHei;
  765. font-weight: bold;
  766. font-size: 16px;
  767. color: #D5D5D5;
  768. text-align: center;
  769. font-style: normal;
  770. text-transform: none;
  771. }
  772. .number {
  773. display: inline-block;
  774. width: 32px;
  775. height: 32px;
  776. line-height: 32px;
  777. color: #ffffff;
  778. background-color: #d5d5d5;
  779. border-radius: 50%;
  780. }
  781. .bgc {
  782. background-color: #139602;
  783. }
  784. .color {
  785. color: #139602;
  786. }
  787. // 填写广告信息字体及背景颜色
  788. .title:first-child {
  789. color: #139602;
  790. }
  791. .title:first-child .number {
  792. background-color: #139602;
  793. }
  794. // 图标>>
  795. .icon {
  796. padding: 0 165px;
  797. }
  798. }
  799. // 1.填写信息内容
  800. .textOne {
  801. width: 1100px;
  802. overflow: hidden;
  803. // height: 515px;
  804. margin-top: 35px;
  805. margin-left: 50px;
  806. .pic {
  807. margin-left: 30px;
  808. width: 80px;
  809. height: 21px;
  810. padding-left: 30px;
  811. font-family: Microsoft YaHei, Microsoft YaHei;
  812. font-weight: 400;
  813. font-size: 16px;
  814. color: #47ACFF;
  815. line-height: 19px;
  816. text-align: left;
  817. font-style: normal;
  818. text-transform: none;
  819. }
  820. //示意图
  821. .my-header {
  822. display: flex;
  823. flex-direction: row;
  824. justify-content: space-between;
  825. gap: 16px;
  826. .el-button {
  827. border-radius: var(--el-border-radius-base);
  828. font-size: var(--el-font-size-base);
  829. background: #ee8787;
  830. border: none;
  831. }
  832. }
  833. .graph {
  834. background-color: #fff;
  835. padding: 40px 60px 80px;
  836. overflow: hidden;
  837. display: flex;
  838. li {
  839. float: left;
  840. span {
  841. display: inline-block;
  842. width: 246px;
  843. font-family: Microsoft YaHei, Microsoft YaHei;
  844. font-weight: bold;
  845. font-size: 16px;
  846. color: #333333;
  847. line-height: 30px;
  848. text-align: center;
  849. margin-bottom: 15px;
  850. }
  851. img {
  852. width: 246px;
  853. height: 344px;
  854. }
  855. }
  856. >li:first-child {
  857. margin-right: 60px;
  858. }
  859. >li:last-child {
  860. margin-left: 60px;
  861. }
  862. }
  863. // 页面中的表格
  864. .pageTable {
  865. width: 90%;
  866. overflow: hidden;
  867. padding-bottom: 60px;
  868. margin-left: 110px;
  869. box-sizing: border-box;
  870. :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
  871. background-color: #333;
  872. border-color: #333;
  873. }
  874. :deep(.el-table tr) {
  875. background-color: #fafafa;
  876. height: 74px;
  877. }
  878. :deep(.el-table .cell) {
  879. text-align: center;
  880. box-sizing: border-box;
  881. height: 23px;
  882. line-height: 23px;
  883. overflow-wrap: break-word;
  884. padding: 0 12px;
  885. text-overflow: ellipsis;
  886. white-space: normal;
  887. font-family: Microsoft YaHei, Microsoft YaHei;
  888. font-weight: 400;
  889. font-size: 16px;
  890. color: #333333;
  891. line-height: 19px;
  892. font-style: normal;
  893. text-transform: none;
  894. }
  895. }
  896. :deep(.el-select) {
  897. --el-select-width: 30%;
  898. }
  899. :deep(.el-form-item) {
  900. margin-bottom: 35px;
  901. }
  902. .el-col {
  903. height: 36px;
  904. }
  905. .el-col-2 {
  906. text-align: center;
  907. }
  908. .chooseImg {
  909. display: block;
  910. }
  911. .chooseImgDiv {
  912. font-size: 16px;
  913. font-style: normal;
  914. }
  915. .avatar-uploader {
  916. width: 120px;
  917. height: 120px;
  918. border: 1px solid #ededed;
  919. border-radius: 12px;
  920. }
  921. .avatar-uploader .avatar {
  922. width: 120px;
  923. border-top-left-radius: 12px;
  924. border-top-right-radius: 12px;
  925. }
  926. .avatar-uploader .el-upload {
  927. border: 1px dashed var(--el-border-color);
  928. border-radius: 6px;
  929. cursor: pointer;
  930. position: relative;
  931. overflow: hidden;
  932. transition: var(--el-transition-duration-fast);
  933. }
  934. .avatar-uploader .el-upload:hover {
  935. border-color: var(--el-color-primary);
  936. }
  937. .el-icon.avatar-uploader-icon {
  938. display: block;
  939. font-size: 36px;
  940. color: #8c939d;
  941. background-color: #fafafa;
  942. width: 120px;
  943. height: 120px;
  944. padding-top: 30px;
  945. box-sizing: border-box;
  946. border: 1px solid #EDEDED;
  947. border-radius: 12px;
  948. text-align: center;
  949. }
  950. >p {
  951. width: 1110px;
  952. height: 75px;
  953. strong {
  954. font-weight: 500;
  955. color: #333333;
  956. padding: 0 14px;
  957. }
  958. label {
  959. display: inline-block;
  960. width: 125px;
  961. text-align: right;
  962. padding-right: 10px;
  963. box-sizing: border-box;
  964. font-family: Microsoft YaHei, Microsoft YaHei;
  965. font-weight: 400;
  966. font-size: 16px;
  967. color: #333333;
  968. line-height: 19px;
  969. font-style: normal;
  970. text-transform: none;
  971. }
  972. >label::before {
  973. content: "*";
  974. display: inline-block;
  975. width: 10px;
  976. height: 2px;
  977. color: #fe0101;
  978. }
  979. span {
  980. color: #fe0101;
  981. display: block;
  982. padding-left: 135px;
  983. height: 30px;
  984. }
  985. .upload-demo {
  986. display: inline-block;
  987. width: 112px;
  988. height: 112px;
  989. vertical-align: -93px;
  990. }
  991. //上传图片相关样式
  992. .avatar-uploader .el-upload {
  993. border: 1px dashed var(--el-border-color);
  994. border-radius: 6px;
  995. cursor: pointer;
  996. position: relative;
  997. overflow: hidden;
  998. transition: var(--el-transition-duration-fast);
  999. }
  1000. .avatar-uploader .el-upload:hover {
  1001. border-color: var(--el-color-primary);
  1002. }
  1003. .el-icon.avatar-uploader-icon {
  1004. font-size: 28px;
  1005. color: #8c939d;
  1006. width: 178px;
  1007. height: 178px;
  1008. text-align: center;
  1009. }
  1010. //上传图片相关样式 end
  1011. :deep(.el-input__wrapper.is-focus) {
  1012. box-shadow: 0 0 0 1px #c0c4cc;
  1013. }
  1014. :deep(.el-date-editor.el-input),
  1015. :deep(.el-date-editor.el-input__wrapper) {
  1016. height: 44px;
  1017. width: 470px;
  1018. }
  1019. :deep(.el-input__inner) {
  1020. font-size: 16px;
  1021. }
  1022. :deep(.el-upload-dragger) {
  1023. padding: 0;
  1024. margin: 0;
  1025. border: 1px solid #ededed;
  1026. }
  1027. :deep(.el-upload-dragger .el-icon--upload) {
  1028. font-size: 67px;
  1029. line-height: 50px;
  1030. padding: 0;
  1031. margin: 0;
  1032. }
  1033. :deep(.el-upload-dragger .el-upload__text) {
  1034. font-size: 18px;
  1035. font-weight: 400;
  1036. color: #999;
  1037. text-align: center;
  1038. margin-bottom: 14px;
  1039. margin-top: 5px;
  1040. }
  1041. :deep(.el-icon svg) {
  1042. width: 34px;
  1043. height: 34px;
  1044. }
  1045. }
  1046. }
  1047. // 2.选择相应网站
  1048. .textTwo {
  1049. width: 1200px;
  1050. overflow: hidden;
  1051. // 页面头部搜索和按钮
  1052. .pageTop {
  1053. width: 1150px;
  1054. height: 44px;
  1055. margin: 30px 0 40px 50px;
  1056. >.left {
  1057. font-family: Microsoft YaHei, Microsoft YaHei;
  1058. font-weight: 400;
  1059. font-size: 16px;
  1060. color: #333333;
  1061. line-height: 19px;
  1062. >a {
  1063. width: 80px;
  1064. height: 21px;
  1065. padding-left: 30px;
  1066. font-family: Microsoft YaHei, Microsoft YaHei;
  1067. font-weight: 400;
  1068. font-size: 16px;
  1069. color: #47ACFF;
  1070. line-height: 19px;
  1071. text-align: left;
  1072. font-style: normal;
  1073. text-transform: none;
  1074. }
  1075. :deep(.el-select__wrapper.is-focused) {
  1076. box-shadow: 0 0 0 1px var(--el-border-color) inset;
  1077. }
  1078. }
  1079. >.right {
  1080. button {
  1081. width: 94px;
  1082. height: 36px;
  1083. line-height: 36px;
  1084. font-family: Microsoft YaHei, Microsoft YaHei;
  1085. font-weight: 400;
  1086. font-size: 16px;
  1087. color: #33B023;
  1088. line-height: 19px;
  1089. text-align: center;
  1090. border: none;
  1091. border-radius: 7px;
  1092. }
  1093. .reset {
  1094. border: 1px solid #33B023;
  1095. color: #33B023;
  1096. background-color: #fff;
  1097. margin-right: 25px;
  1098. }
  1099. .search {
  1100. background-color: #33B023;
  1101. color: #ffffff;
  1102. }
  1103. }
  1104. }
  1105. //示意图
  1106. .my-header {
  1107. display: flex;
  1108. flex-direction: row;
  1109. justify-content: space-between;
  1110. gap: 16px;
  1111. .el-button {
  1112. border-radius: var(--el-border-radius-base);
  1113. font-size: var(--el-font-size-base);
  1114. background: #ee8787;
  1115. border: none;
  1116. }
  1117. }
  1118. .graph {
  1119. background-color: #fff;
  1120. padding: 40px 60px 80px;
  1121. overflow: hidden;
  1122. display: flex;
  1123. li {
  1124. float: left;
  1125. span {
  1126. display: inline-block;
  1127. width: 246px;
  1128. font-family: Microsoft YaHei, Microsoft YaHei;
  1129. font-weight: bold;
  1130. font-size: 16px;
  1131. color: #333333;
  1132. line-height: 30px;
  1133. text-align: center;
  1134. margin-bottom: 15px;
  1135. }
  1136. img {
  1137. width: 246px;
  1138. height: 344px;
  1139. }
  1140. }
  1141. >li:first-child {
  1142. margin-right: 60px;
  1143. }
  1144. >li:last-child {
  1145. margin-left: 60px;
  1146. }
  1147. }
  1148. // 页面中的表格
  1149. .pageTable {
  1150. width: 100%;
  1151. overflow: hidden;
  1152. padding-bottom: 60px;
  1153. :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
  1154. background-color: #333;
  1155. border-color: #333;
  1156. }
  1157. :deep(.el-table tr) {
  1158. background-color: #fafafa;
  1159. height: 74px;
  1160. }
  1161. :deep(.el-table .cell) {
  1162. text-align: center;
  1163. box-sizing: border-box;
  1164. height: 23px;
  1165. line-height: 23px;
  1166. overflow-wrap: break-word;
  1167. padding: 0 12px;
  1168. text-overflow: ellipsis;
  1169. white-space: normal;
  1170. font-family: Microsoft YaHei, Microsoft YaHei;
  1171. font-weight: 400;
  1172. font-size: 16px;
  1173. color: #333333;
  1174. line-height: 19px;
  1175. font-style: normal;
  1176. text-transform: none;
  1177. }
  1178. }
  1179. // 页码
  1180. .pagination {
  1181. display: flex;
  1182. justify-content: center;
  1183. // margin-top: 60px;
  1184. margin-bottom: 90px;
  1185. // 鼠标移入后字体颜色
  1186. :deep(.el-pagination:hover) {
  1187. color: #139609;
  1188. }
  1189. :deep(.el-pagination.is-background .btn-next),
  1190. :deep(.el-pagination.is-background .btn-prev) {
  1191. width: 70px;
  1192. height: 34px;
  1193. margin: 0px 10px;
  1194. border-radius: 4px;
  1195. }
  1196. :deep(.el-pagination.is-background .el-pager li) {
  1197. margin: 0px 10px;
  1198. width: 38px;
  1199. height: 34px;
  1200. border-radius: 4px;
  1201. }
  1202. :deep(.el-pagination.is-background .btn-next.is-active),
  1203. :deep(.el-pagination.is-background .btn-prev.is-active),
  1204. :deep(.el-pagination.is-background .el-pager li.is-active) {
  1205. background-color: #028e21;
  1206. color: #fff;
  1207. }
  1208. }
  1209. }
  1210. // 3.提交工单信息
  1211. .submit {
  1212. width: 1200px;
  1213. overflow: hidden;
  1214. text-align: center;
  1215. .inner {
  1216. width: 1100px;
  1217. padding-left: 50px;
  1218. padding-bottom: 130px;
  1219. font-family: Microsoft YaHei, Microsoft YaHei;
  1220. font-style: normal;
  1221. text-transform: none;
  1222. // 标题
  1223. >h1 {
  1224. margin-top: 80px;
  1225. margin-bottom: 30px;
  1226. font-weight: bold;
  1227. font-size: 26px;
  1228. color: #333333;
  1229. line-height: 30px;
  1230. text-align: center;
  1231. }
  1232. // 工单编号
  1233. >p {
  1234. margin-bottom: 257px;
  1235. font-weight: 400;
  1236. font-size: 22px;
  1237. color: #333333;
  1238. text-align: center;
  1239. }
  1240. // 按钮
  1241. >.btn {
  1242. margin-bottom: 30px;
  1243. button {
  1244. width: 134px;
  1245. height: 50px;
  1246. border: none;
  1247. font-weight: 400;
  1248. font-size: 16px;
  1249. text-align: center;
  1250. border-radius: 7px;
  1251. }
  1252. .check {
  1253. background-color: #fff;
  1254. color: #33B023;
  1255. border: 1px solid #33B023;
  1256. margin-right: 160px;
  1257. }
  1258. .apply {
  1259. background-color: #33B023;
  1260. color: #fff;
  1261. }
  1262. }
  1263. // 提示文字
  1264. >span {
  1265. font-weight: 400;
  1266. font-size: 14px;
  1267. color: #999999;
  1268. }
  1269. }
  1270. }
  1271. }
  1272. }
  1273. }
  1274. //工单列表
  1275. #orderList {
  1276. width: 1200px;
  1277. margin: 0 auto;
  1278. }
  1279. }
  1280. //广告页面底部部分
  1281. .bottom {
  1282. width: 1200px;
  1283. height: 145px;
  1284. background-color: #ecf5ee;
  1285. padding: 0px 30px;
  1286. margin: 0 auto;
  1287. box-sizing: border-box;
  1288. // display: none;
  1289. .inner {
  1290. width: 1200px;
  1291. height: 145px;
  1292. padding: 0;
  1293. .amount {
  1294. float: left;
  1295. padding-top: 52px;
  1296. font-family: Microsoft YaHei, Microsoft YaHei;
  1297. font-weight: 400;
  1298. font-size: 16px;
  1299. color: #333333;
  1300. line-height: 19px;
  1301. text-align: left;
  1302. font-style: normal;
  1303. text-transform: none;
  1304. span {
  1305. padding: 0 15px 0 25px;
  1306. font-family: Microsoft YaHei, Microsoft YaHei;
  1307. font-weight: bold;
  1308. font-size: 24px;
  1309. color: #028E21;
  1310. line-height: 28px;
  1311. text-align: left;
  1312. font-style: normal;
  1313. text-transform: none;
  1314. }
  1315. }
  1316. .btn {
  1317. float: right;
  1318. margin-right: 60px;
  1319. .btn1 {
  1320. width: 115px;
  1321. height: 40px;
  1322. font-size: 16px;
  1323. background-color: #ffffff;
  1324. color: #028e21;
  1325. border: 1px solid #028e21;
  1326. border-radius: 6px;
  1327. margin-right: 50px;
  1328. margin-top: 53px;
  1329. }
  1330. .btn2 {
  1331. width: 115px;
  1332. height: 40px;
  1333. font-size: 16px;
  1334. background-color: #028e21;
  1335. color: #ffffff;
  1336. border: none;
  1337. border-radius: 6px;
  1338. margin: 53px 0;
  1339. }
  1340. }
  1341. }
  1342. }
  1343. }
  1344. </style>