index.vue 55 KB

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