index.vue 55 KB

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