12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703 |
- <template>
- <!-- 广告服务 -->
- <div>
- <!-- 广告页面头部 -->
- <!-- <AdvertisingHead></AdvertisingHead> -->
- <HomePageHead></HomePageHead>
- <HomePageNavigation></HomePageNavigation>
- <div class="adtips">
- <div class="inner">
- <p v-if="activeName == '1'">注意:广告购买需提交信息,用户与商务人员进行线下金额交易,交易成功后由商务人员后台审核。审核通过,即广告投放成功。</p>
- </div>
- </div>
- <div class="advertising">
- <div class="inner">
- <el-tabs v-model="activeName" :tab-position="tabPosition" class="demo-tabs" @tab-change="goOrderList">
- <!-- {{ ad }} -->
- <el-tab-pane label="广告购买" name="1" @click="goBuyAd">
- <!-- 广告购买 -->
- <div id="buyAd">
- <div class="buyAD">
- <div class="inner">
- <!-- 填写广告信息内容 -->
- <div class="textOne" v-if="ad == 1">
- <el-form ref="ruleFormRef" :model="ruleForm" :rules="rules" label-width="120"
- class="demo-ruleForm" :size="formSize" status-icon>
- <el-form-item label="广告名称:" prop="adName">
- <el-input v-model="ruleForm.adName" placeholder="请输入广告名称" />
- </el-form-item>
- <el-form-item label="广告链接:" prop="adLink">
- <el-input v-model="ruleForm.adLink" placeholder="请输入广告链接" />
- </el-form-item>
- <el-form-item label="广告持续时间:" required>
- <el-config-provider :locale="zhCn">
- <!-- <el-date-picker v-model="ruleForm.time" type="daterange"
- range-separator="至" start-placeholder="请选择开始时间"
- end-placeholder="请选择结束时间" :size="size" @change="changeStartTime"
- :disabled-date="disabledStartTime" /> -->
- <el-date-picker v-model="ruleForm.time" type="datetimerange"
- format="YYYY-MM-DD HH:mm"
- value-format="YYYY-MM-DD HH:00:00"
- range-separator="至" start-placeholder="请选择开始时间"
- end-placeholder="请选择结束时间" :size="size" @change="changeStartTime"
- :disabled-date="disabledStartTime"
- :disabledMinutes="disabledMinutes">
- </el-date-picker>
- </el-config-provider>
- </el-form-item>
- <el-form-item label="广告尺寸:" prop="adSize">
- <el-radio-group v-model="ruleForm.adSize">
- <el-radio :value="item.id" v-for="item in options" :key="item.id"
- @change="changeAdSize">{{
- item.size }}</el-radio>
- </el-radio-group>
- <!-- <el-select v-model="ruleForm.adSize" placeholder="请选择广告尺寸" @change="changeAdSize">
- <el-option v-for="item in options" :key="item.id" :label="item.size"
- :value="item.id"></el-option>
- </el-select> -->
- <a class="pic" @click="goPhoto">查看示意图</a>
- </el-form-item>
- <!-- 表格部分 -->
- <div class="pageTable">
- <el-table :data="tableData" border ref="multipleTable" empty-text="请先选择广告持续时间"
- @selection-change="handleSelectionChange" style="width: 100%"
- :header-row-style="{ height: '60px' }"
- :row-style="{ height: '74px' }"
- :header-cell-style="{ backgroundColor: '#fafafa', color: '#666' }">
- <!-- <el-table-column type="selection" :reserve-selection="true"
- width="152" align="center" /> -->
- <el-table-column width="" align="center">
- <template #default="{ row }">
- <el-checkbox v-model="row.selected"
- @change="toggleRowSelection(row)">
- </el-checkbox>
- </template>
- </el-table-column>
- <el-table-column prop="website_name" label="网站" width="220" />
- <el-table-column prop="name" label="广告位名称" width="320" />
- <el-table-column prop="size" label="广告尺寸" width="180" />
- <el-table-column prop="price" label="金额 (元) / 天" width="160" />
- </el-table>
- </div>
- <el-form-item label="广告图:" prop="adImg">
- <el-upload class="avatar-uploader" action="#" :show-file-list="false"
- :on-success="handleAvatarSuccess"
- :before-upload="beforeAvatarUpload" accept=".jpg,.jpeg,.png">
- <img v-if="imageUrl" :src="imageUrl" class="avatar" />
- <div v-else>
- <el-icon class="avatar-uploader-icon">
- <Plus></Plus>
- <div class="chooseImgDiv">选择图片</div>
- </el-icon>
- </div>
- </el-upload>
- </el-form-item>
- </el-form>
- <!-- 示意图弹框 -->
- <el-dialog v-model="dialogTableVisible" :show-close="false" width="1280px"
- :close-on-click-modal="false">
- <template #header="{ close, titleId, titleClass }">
- <div class="my-header">
- <h4 :id="titleId" :class="titleClass" class="left">示意图类型</h4>
- <el-button type="danger" @click="close" class="right">
- <el-icon class="el-icon--left">
- <CircleCloseFilled />
- </el-icon>
- 关闭
- </el-button>
- </div>
- </template>
- <div class="block text-center dialogPicBox" m="t-4">
- <el-carousel trigger="click" height="680px" autoplay="">
- <el-carousel-item>
- <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/ad/new1.png" alt="">
- </el-carousel-item>
- <el-carousel-item>
- <img src="http://img.bjzxtw.org.cn/master/bjzxtw/public/ad/new2.png" alt="">
- </el-carousel-item>
- </el-carousel>
- </div>
- </el-dialog>
- </div>
- <!-- 提交工单信息 -->
- <div class="submit" v-if="ad == 2">
- <div class="inner">
- <h1>广告信息已提交成功,请等待审核......</h1>
- <p>
- 工单编号:
- <span>{{ orderInformation }}</span>
- </p>
- <div class="btn">
- <button class="check" @click="lookOrder">查看工单</button>
- <button class="apply" @click="reapply">再次申请</button>
- </div>
- <span>如有疑问,可联系客服人员。</span>
- </div>
- </div>
- </div>
- </div>
- </div>
- </el-tab-pane>
- <el-tab-pane label="工单列表" name="2">
- <!-- 工单列表 -->
- <AdvertisingOrderList @childData="handleChildData"></AdvertisingOrderList>
- </el-tab-pane>
- </el-tabs>
- </div>
- <div class="bottom" v-if="ad == 1 && activeName == '1'" :key="ad">
- <div class="inner">
- <!-- 总金额 -->
- <div class="amount" v-if="ad == 1">
- 总金额:
- <span>{{ priceTotal == '' ? 0 : priceTotal }}</span>
- 元
- </div>
- <!-- 按钮 -->
- <div class="btn">
- <button class="btn2" @click="submitStep" v-if="ad == 1"> 提交工单</button>
- </div>
- </div>
- </div>
- </div>
- <!-- 广告页面底部 -->
- <HomeFoot1></HomeFoot1>
- </div>
- </template>
- <script setup>
- import { ref, onMounted, watch, reactive } from 'vue'
- // import { ElCheckbox, ElRadio, ElRadioGroup, ElDatePicker, ElInput, ElUpload, ElPagination, ElIcon, ElSelect, ElOption, ElTabs, ElTabPane, ElTable, ElTableColumn, ElMessage, ElForm, ElFormItem, ElCol, valueEquals } from 'element-plus'
- import { ElCheckbox, ElRadio, ElRadioGroup, ElDatePicker, ElInput, ElUpload, ElPagination, ElIcon, ElSelect, ElOption, ElTabs, ElTabPane, ElTable, ElTableColumn, ElMessage, ElForm, ElFormItem, ElCol, valueEquals, ElConfigProvider,ElCarousel, ElCarouselItem } from 'element-plus'
- import { ElButton, ElDialog } from 'element-plus'
- import { CircleCloseFilled } from '@element-plus/icons-vue'
- import { Plus, DArrowRight, Edit, Picture, UploadFilled } from '@element-plus/icons-vue'
- import zhCn from 'element-plus/dist/locale/zh-cn.mjs';
- import { getToken, setToken, removeToken } from '@/store/useCookieStore'
- const { $webUrl, $CwebUrl, $BwebUrl } = useNuxtApp()
- import { useRoute } from 'vue-router'
- const route = useRoute()
- // axios请求
- const nuxtApp = useNuxtApp();
- const axios = nuxtApp.$axios;
- // 通过变量ad控制tab栏标题的颜色及每一步下的不同的内容
- let ad = useState("ad", () => 1)
- let dialogTableVisible = useState("dialogTableVisible", () => false)//示意图弹框
- let dialogTableVisible1 = useState("dialogTableVisible1", () => false)//示意图弹框
- let activeName = useState("activeName", () => "1")
- let startTime = useState("startTime", () => new Date())
- let adSize = useState("adSize", () => "")
- let tableData = useState("tableData", () => [])
- let processedData = useState("processedData", () => [])
- let pid = useState("pid", () => [])
- let pids = useState("pids", () => [])
- let pidArr = useState("pidArr", () => [])
- let orderInformation = useState("orderInformation", () => "")
- let adWeb = useState("adWeb", () => "")
- let adWebId = useState("adWebId", () => "")
- let adWebList = useState("adWebList", () => [])
- let priceTotal = useState("priceTotal", () => '')//总金额
- let orderId = useState("orderId", () => "")
- let options = useState('options', () => [])
- const multipleTable = ref('');
- let shopCode = useState('shopCode', () => '')
- let token = useState('token', () => '')
- let showToken = useState("showToken", () => '')
- watch(token, (newval, oldval) => {
- console.log(newval, oldval);
- showToken.value = newval
- }, {
- deep: true,
- immediate: true,
- })
- // 定义响应式数据
- const seoData = ref({
- title: '广告服务',
- description: '默认描述',
- keywords: '默认关键词',
- image: 'https://example.com/default-image.jpg'
- });
- // 在 onMounted 钩子中获取数据
- onMounted(() => {
- seoData.value.title = '广告服务';
- seoData.value.description = '默认描述';
- seoData.value.keywords = '默认关键词';
- })
- let goTopic = () => {
- navigateTo({
- path: "/topic"
- })
- }
- let goAD = () => {
- navigateTo({
- path: "/advertising"
- })
- }
- let goLogin = () => {
- token.value = getToken()
- // window.location.href = ("http://adminpre.bjzxtw.org.cn/#/login?backurl=http%3a%2f%2fnwdev.bjzxtw.org.cn%2f")
- let url = $BwebUrl + '/auth/login.php?backurl=' + $CwebUrl;
- window.location.href = url;
- token.value = getToken()
- }
- let goReg = () => {
- dialogTableVisible1.value = true
- }
- let goUserInfo = () => {
- }
- // 分页
- let total = useState('total', () => 0)
- let pageSize = useState("pageSize", () => 20)
- let page = useState("page", () => 1)
- //ruleForm
- let logoUrl = ref('');
- const formSize = ref('default');
- const ruleFormRef = ref();
- const ruleForm = reactive({
- adName: '',
- adLink: '',
- time: '',
- startTime: '',
- endTime: '',
- adSize: 1,
- adImg: '',
- });
- const rules = reactive({
- adName: [{ required: true, message: '请输入广告名称', trigger: 'blur' }],
- adLink: [{ required: true, message: '请输入广告链接', trigger: 'change' }],
- startTime: [{ required: true, message: '请输入开始时间', trigger: 'change' }],
- endTime: [{ required: true, message: '请输入结束时间', trigger: 'change' }],
- adSize: [{ required: true, message: '请选择广告尺寸', trigger: 'change' }],
- adImg: [{ required: true, message: '请选择广告图', trigger: 'change' }],
- });
- const tabPosition = ref('left')
- //禁用分钟
- const disabledMinutes = () => {
- return Array.from({ length: 60 }, (_, i) => i).filter(minute => minute !== 0);
- }
- // 获取开始时间
- let changeStartTime = (val) => {
- //第一步,获取用户选择的时间跟当前时间进行对比
- let setTime = new Date(new Date(val[0])).getTime();
- let localtime = new Date().getTime();
- if(setTime < localtime){
- //第二步,将时间戳转换为本地时间
- ElMessage.error('时间选择错误,已为您自动重设!');
- //获取当前小时之后的整数小时0分0秒
- let time1 = new Date(new Date(val[0]).setMinutes(0, 0, 0) + 60 * 60 * 1000).getTime();
- let time2 = new Date(new Date(val[1]).setMinutes(0, 0, 0) + 60 * 60 * 1000).getTime();
- //同样的道理,获取当前时间的下一个整数小时0分0秒
- let currentTimestamp = new Date(new Date().setMinutes(0, 0, 0) + 60 * 60 * 1000).getTime();
- let localTime = new Date(currentTimestamp).toLocaleString('zh-CN', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit'
- }).replace(/\//g, '-');
- //第三步,将当前时间加24小时
- let twoHoursLocalTime = new Date(currentTimestamp + 24 * 60 * 60 * 1000).toLocaleString('zh-CN', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit'
- }).replace(/\//g, '-');
- //第四步,将当前时间赋值给ruleForm.time[0]
- ruleForm.time[0] = localTime;
- ruleForm.time[1] = twoHoursLocalTime;
- ruleForm.startTime = localTime;
- ruleForm.endTime = twoHoursLocalTime;
- //获取广告尺寸
- getAdSize()
- //创建购物车
- axios.post("/order/addShoppingCart").then(response => {
- // console.log("创建购物车", response.data);
- shopCode.value = response.data
- console.log('shopCode', shopCode.value);
- })
- }else{
- //获取当前小时之后的整数小时0分0秒
- let time1 = new Date(new Date(val[0]).setMinutes(0, 0, 0) + 60 * 60 * 1000).getTime();
- let time2 = new Date(new Date(val[1]).setMinutes(0, 0, 0) + 60 * 60 * 1000).getTime();
- //同样的道理,获取当前时间的下一个整数小时0分0秒
- let currentTimestamp = new Date(new Date().setMinutes(0, 0, 0) + 60 * 60 * 1000).getTime();
- //第二种情况,传入的时间戳大于当前时间
- //但是时间间隔小于2小时
- if(time2 - time1 < 24 * 60 * 60 * 1000){
- ElMessage.error('广告持续时间不得低于24小时,已为您自动重设!');
- //第一步,将时间戳转换为本地时间
- let localTime = new Date(currentTimestamp).toLocaleString('zh-CN', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit'
- }).replace(/\//g, '-');
- //第二步,将当前时间加2小时
- let twoHoursLocalTime = new Date(currentTimestamp + 24 * 60 * 60 * 1000).toLocaleString('zh-CN', {
- year: 'numeric',
- month: '2-digit',
- day: '2-digit',
- hour: '2-digit',
- minute: '2-digit'
- }).replace(/\//g, '-');
-
- //第三步,将当前时间赋值给ruleForm.time[0]
- ruleForm.time[0] = localTime;
- ruleForm.time[1] = twoHoursLocalTime;
- ruleForm.startTime = localTime;
- ruleForm.endTime = twoHoursLocalTime;
-
- //获取广告尺寸
- getAdSize()
- //创建购物车
- axios.post("/order/addShoppingCart").then(response => {
- // console.log("创建购物车", response.data);
- shopCode.value = response.data
- console.log('shopCode', shopCode.value);
- })
- }else{
- //第三种情况,用户时间选择正确,无需操作
- ruleForm.startTime = val[0]
- ruleForm.endTime = val[1]
- //获取广告尺寸
- getAdSize()
- //创建购物车
- axios.post("/order/addShoppingCart").then(response => {
- // console.log("创建购物车", response.data);
- shopCode.value = response.data
- console.log('shopCode', shopCode.value);
- })
- }
- }
- //第四种情况,使广告立即生效,请注释上面的if 直接使用下面这一段
- // ruleForm.startTime = val[0]
- // ruleForm.endTime = val[1]
- // //获取广告尺寸
- // getAdSize()
- // //创建购物车
- // axios.post("/order/addShoppingCart").then(response => {
- // // console.log("创建购物车", response.data);
- // shopCode.value = response.data
- // console.log('shopCode', shopCode.value);
- // })
- }
- //禁止选择的时间区域
- let disabledStartTime = (time) => {
- // console.log("time", time);
- return time.getTime() <= (Date.now() - 3600 * 1000 * 24);
- }
- const imageUrl = ref('');
- const handleAvatarSuccess = (response, uploadFile) => {
- imageUrl.value = URL.createObjectURL(uploadFile.raw);
- };
- const bb = (item) => {
- console.log("===", item)
- navigateTo({
- path: "/advertising/addetail",
- query: {
- id: item
- }
- })
- }
- //获取图片地址
- const beforeAvatarUpload = (file) => {
- console.log('file', file);
- if (!file) return;
- const isJPG = file.type === 'image/jpeg';
- const isPNG = file.type === 'image/png';
- const isLt2M = file.size / 1024 / 1024 < 2;
- if (!isJPG && !isPNG) {
- ElMessage.error('上传图片只能是 JPG 或 PNG 格式!');
- return;
- }
- if (!isLt2M) {
- ElMessage.error('上传图片大小不能超过 2MB!');
- return;
- }
- const data = new FormData();
- data.append('file', file);
- axios.post("/public/uploadFile", data).then(res => {
- console.log(res);
- logoUrl.value = res.data.imgUrl;
- ruleForm.adImg = res.data.imgUrl;
- }).catch(() => {
- ElMessage({
- type: 'info',
- message: '网络错误,请重试!'
- });
- });
- };
- let goPhoto = () => {
- dialogTableVisible.value = true
- }
- //选择的广告位
- let handleSelectionChange = (selectedRows) => {
- pidArr.value = selectedRows.map(row => row.pid);
- console.log("选中的广告位llllllllll", pidArr.value);
- // getPrice() //获取总金额
- let aa = JSON.parse(JSON.stringify(pidArr.value))
- console.log("pids", aa);
- for (let item = 0; item <= aa.length - 1; item++) {
- console.log('pidArr.value', aa[item]);
- pids.value = aa[item]
- }
- }
- pidArr.value.forEach((item) => {
- const index = tableData.findIndex((row) => row.id === item);
- if (index !== -1) {
- tableData[index].selected = true;
- }
- });
- let toggleRowSelection = (row) => {
- console.log('11111', row.pid);
- console.log('类型', typeof (row.pid));
- // 判断 row.pid 是否已经存在于 pid.value 数组中
- const isExist = pid.value.includes(row.pid);
- console.log('判断当前选择的id是否已被选择', isExist); // 输出: true
- if (isExist) {
- //删除购物车中的广告位
- let data = {
- shopping_id: shopCode.value,
- pid: row.pid,
- }
- //删除购物车接口
- axios.post('/order/delShoppingCartAD', data).then(data => {
- console.log('删除购物车广告位--------------', data);
- if (data.code == 200) {
- getShoppingCartAD()
- }
- })
- } else {
- //添加购物车中的广告位
- let data = {
- shopping_id: shopCode.value,
- pid: row.pid,
- }
- //添加购物车接口
- axios.post('/order/addShoppingCartAD', data).then(data => {
- console.log('添加购物车广告位--------------', data);
- if (data.code == 200) {
- getShoppingCartAD()
- }
- })
- }
- };
- onMounted(() => {
- tableData.value.forEach((row) => {
- console.log(row);
- if (row.selected) {
- multipleTable.value.toggleRowSelection(row, true);
- }
- });
- });
- //获取广告尺寸列表
- let adSizeList = () => {
- // 搜索按钮接口
- axios.post("/order/getAD").then(response => {
- console.log("response111", response);
- options.value = response.data
- for (let item of options.value) {
- console.log(item);
- item.size = item.width + ' * ' + item.height + ' px '
- // ruleForm.adSize = item.id
- }
- console.log("=========", options.value);
- })
- }
- //查看工单
- let lookOrder = () => {
- activeName.value = '2'
- sessionStorage.setItem('activeName', JSON.stringify('2'));
- // window.location.href = (`http://localhost:3000/advertising?activeName=${'2'}`)
- let url = $CwebUrl + '/advertising?activeName=2';
- window.location.href = url;
- }
- //再次申请
- let reapply = () => {
- ad.value = 1
- // window.location.href = ('http://localhost:3000/advertising')
- let url = $CwebUrl + '/advertising';
- window.location.href = url;
- }
- //获取总金额
- const getPrice = () => {
- let data = {
- starttime: ruleForm.startTime,
- endtime: ruleForm.endTime,
- pid: pid.value
- }
- console.log('data=========', data);
- axios.post('/order/getPrice', data).then(data => {
- console.log('获取到的金额', data.data);
- priceTotal.value = data.data
- })
- }
- //获取购物车广告位
- const getShoppingCartAD = () => {
- axios.post('/order/getShoppingCartAD', {
- shopping_id: shopCode.value
- }).then(data => {
- console.log('获取购物车广告位=====================', data.data.pid);
- pid.value = data.data.pid
- getPrice()
- })
- }
- //挂载成功
- onMounted(() => {
- adSizeList()
- getPrice()
- if (route.query.activeName == '1' || route.query.activeName == '2') {
- activeName.value = route.query.activeName;
- }
- if (!route.query.activeName) {
- activeName.value = JSON.parse(sessionStorage.getItem('activeName'));
- // console.log('activeName', activeName.value);
- }
- })
- onMounted(() => {
- // ad.value=route.query.ad
- watch(activeName, (newval) => {
- console.log('activeName', newval);
- sessionStorage.setItem('activeName', JSON.stringify(newval));
- }, {
- deep: true,
- immediate: true
- })
- })
- //6.子组件传递的数据 start ---------------------------------------->
- let handleChildData = (data) => {
- activeName.value = `${data}`
- }
- //6.子组件传递的数据 end ---------------------------------------->
- //广告尺寸发生变化的时候
- let changeAdSize = (val) => {
- console.log('val', val);
- ruleForm.adSize = val
- getAdSize()
- }
- //获取广告尺寸
- let getAdSize = () => {
- // 获取广告位需要传递的参数
- let adData = {
- ad_size_id: ruleForm.adSize,
- starttime: ruleForm.startTime,
- endtime: ruleForm.endTime,
- pageSize: pageSize.value,
- page: page.value,
- }
- //获取广告位
- axios.post("/order/getWebsiteAd", adData).then(response => {
- console.log("广告位", response.data);
- // console.log("广告位信息", response.data.rows);
- total.value = response.data.count
- tableData.value = response.data.rows
- for (let item of tableData.value) {
- item.size = item.size_width + ' * ' + item.size_height + ' px '
- item.selected = false
- }
- console.log('tableData', tableData.value);
- }).catch(error => {
- console.log(error);
- })
- }
- // 点击提交工单信息
- let submitStep = () => {
- // 表单验证
- if (ruleForm.adName == '') {
- ElMessage({
- message: '请输入广告名称',
- type: 'error',
- })
- return
- }
- if (ruleForm.adLink == '') {
- ElMessage({
- message: '请输入广告链接',
- type: 'error',
- })
- return
- }
- if (ruleForm.startTime == '') {
- ElMessage({
- message: '请选择广告持续时间!',
- type: 'error',
- })
- return
- }
- if (ruleForm.endTime == '') {
- ElMessage({
- message: '请选择广告尺寸',
- type: 'error',
- })
- return
- }
- if (ruleForm.adSize == '') {
- ElMessage({
- message: '请选择广告尺寸',
- type: 'error',
- })
- return
- }
- if (ruleForm.adImg == '') {
- ElMessage({
- message: '请添加广告图',
- type: 'error',
- })
- return
- }
- ad.value++
- // 获取广告位需要传递的参数
- let orderData = {
- name: ruleForm.adName,
- ad_size_id: ruleForm.adSize,
- starttime: ruleForm.startTime,
- endtime: ruleForm.endTime,
- imgurl: ruleForm.adLink,
- imgsrc: ruleForm.adImg,
- pid: pid.value,
- price: priceTotal.value
- }
- //提交工单
- axios.post("/order/addAD", orderData).then(response => {
- console.log("提交工单", response); //order_id
- console.log("orderData", orderData);
- if (response.code == 200) {
- tableData.value = response.data.rows
- orderInformation.value = response.data.ordernum
- orderId.value = response.data.order_id
- }
- }).catch(error => {
- console.log(error);
- })
- }
- // // 点击广告购买标签的事件驱动函数
- let goBuyAd = () => {
- activeName.value = '1'
- }
- // 点击工单列表标签的事件驱动函数
- let goOrderList = (item) => {
- if (item == 2 && (route.query.activeName == '1' || route.query.activeName == '2')) {
- // window.location.href = ('http://localhost:3000/advertising')
- let url = $CwebUrl + '/advertising';
- window.location.href = url;
- }
- }
- watch(adSize, (newval) => {
- // console.log('newval', newval);
- adSize.value = newval
- }, {
- deep: true,
- immediate: true
- })
- watch(ad, (newval) => {
- // console.log('adnewval', newval);
- adSize.value = newval
- }, {
- deep: true,
- immediate: true
- })
- </script>
- <style lang="less" scoped>
- // 广告页面头部
- .head {
- width: 100%;
- padding: 15px 0;
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- .inner {
- width: 1200px;
- height: 27px;
- }
- .headLogo {
- .webName {
- display: inline-block;
- span {
- margin-right: 30px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 12px;
- color: #666666;
- line-height: 14px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- }
- >span {
- display: inline-block;
- width: 100px;
- padding-left: 25px;
- vertical-align: middle;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 12px;
- color: #333333;
- line-height: 21px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- border-left: 1px solid #ccc;
- }
- }
- .right {
- span {
- margin-left: 26px;
- font-family: PingFang SC, PingFang SC;
- font-weight: 400;
- font-size: 12px;
- color: #666666;
- line-height: 14px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- .login,
- .reg,
- .user,
- .topic,
- .ad {
- display: inline-block;
- width: 16px;
- height: 16px;
- vertical-align: -6px;
- }
- .topic {
- background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/ad/shopping-mall.png") no-repeat;
- }
- .ad {
- background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/ad/ad-product.png") no-repeat;
- }
- .login {
- background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/ad/user.png") no-repeat;
- }
- .reg {
- background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/ad/write.png") no-repeat;
- }
- .user {
- background: url("http://img.bjzxtw.org.cn/master/bjzxtw/public/ad/user.png") no-repeat;
- }
- }
- .tips1 {
- padding: 20px 0;
- text-align: center;
- font-size: 20px;
- color: #40663B;
- font-weight: bold;
- img {
- width: 78px;
- height: 78px;
- vertical-align: middle;
- margin-right: 20px;
- p {
- line-height: 30px;
- }
- }
- p {
- line-height: 40px;
- }
- >p:first-child {
- margin-bottom: 30px;
- }
- }
- }
- //提示信息
- .adtips {
- width: 100%;
- height: 70px;
- line-height: 70px;
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- .inner {
- width: 1200px;
- height: 70px;
- }
- p {
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #FE0101;
- // line-height: 19px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- }
- .advertising {
- width: 100%;
- overflow: hidden;
- .inner {
- width: 1520px;
- // height: 900px;
- overflow: hidden;
- position: relative;
- // 左侧tab导航
- :deep(.el-tabs--left .el-tabs__header.is-left) {
- margin-top: 50px;
- margin-right: 10px;
- }
- // 左侧tab导航字体颜色
- :deep(.el-tabs__item.is-active),
- :deep(.el-tabs__item:hover) {
- color: #139602;
- // font-weight: bold;
- }
- // 左侧tab导航字体大小
- :deep(.el-tabs--left .el-tabs__item.is-left) {
- text-align: right;
- font-size: 20px;
- }
- // 左侧tab导航下划线
- :deep(.el-tabs__active-bar) {
- background-color: #139602;
- }
- // 广告购买
- #buyAd {
- width: 1200px;
- margin: 0 35px;
- .buyAD {
- width: 1200px;
- overflow: hidden;
- .inner {
- width: 1200px;
- overflow: hidden;
- position: relative;
- // 填写信息页tab标题
- .tabTitle {
- width: 1100px;
- height: 80px;
- padding-top: 26px;
- margin: 0 auto;
- box-sizing: border-box;
- border-bottom: 1px solid rgba(0, 0, 0, 0.1);
- .icon,
- .title {
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 16px;
- color: #D5D5D5;
- text-align: center;
- font-style: normal;
- text-transform: none;
- }
- .number {
- display: inline-block;
- width: 32px;
- height: 32px;
- line-height: 32px;
- color: #ffffff;
- background-color: #d5d5d5;
- border-radius: 50%;
- }
- .bgc {
- background-color: #139602;
- }
- .color {
- color: #139602;
- }
- // 填写广告信息字体及背景颜色
- .title:first-child {
- color: #139602;
- }
- .title:first-child .number {
- background-color: #139602;
- }
- // 图标>>
- .icon {
- padding: 0 165px;
- }
- }
- // 1.填写信息内容
- .textOne {
- width: 1100px;
- overflow: hidden;
- // height: 515px;
- margin-top: 35px;
- margin-left: 50px;
- .pic {
- margin-left: 30px;
- width: 80px;
- height: 21px;
- padding-left: 30px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #47ACFF;
- line-height: 19px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- cursor: pointer;
- }
- //示意图
- .my-header {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- gap: 16px;
- .el-button {
- border-radius: var(--el-border-radius-base);
- font-size: var(--el-font-size-base);
- background: #ee8787;
- border: none;
- }
- }
- .graph {
- background-color: #fff;
- padding: 40px 60px 80px;
- overflow: hidden;
- display: flex;
- li {
- float: left;
- span {
- display: inline-block;
- width: 246px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 16px;
- color: #333333;
- line-height: 30px;
- text-align: center;
- margin-bottom: 15px;
- }
- img {
- width: 246px;
- height: 344px;
- }
- }
- >li:first-child {
- margin-right: 60px;
- }
- >li:last-child {
- margin-left: 60px;
- }
- }
- // 页面中的表格
- .pageTable {
- width: 90%;
- overflow: hidden;
- padding-bottom: 60px;
- margin-left: 110px;
- box-sizing: border-box;
- :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
- background-color: #333;
- border-color: #333;
- }
- :deep(.el-table tr) {
- background-color: #fafafa;
- height: 74px;
- }
- :deep(.el-table .cell) {
- text-align: center;
- box-sizing: border-box;
- height: 23px;
- line-height: 23px;
- overflow-wrap: break-word;
- padding: 0 12px;
- text-overflow: ellipsis;
- white-space: normal;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #333333;
- line-height: 19px;
- font-style: normal;
- text-transform: none;
- }
- }
- :deep(.el-select) {
- --el-select-width: 30%;
- }
- :deep(.el-form-item) {
- margin-bottom: 35px;
- }
- .el-col {
- height: 36px;
- }
- .el-col-2 {
- text-align: center;
- }
- .chooseImg {
- display: block;
- }
- .chooseImgDiv {
- font-size: 16px;
- font-style: normal;
- }
- .avatar-uploader {
- width: 120px;
- height: 120px;
- border: 1px solid #ededed;
- border-radius: 12px;
- }
- .avatar-uploader .avatar {
- width: 120px;
- border-top-left-radius: 12px;
- border-top-right-radius: 12px;
- }
- .avatar-uploader .el-upload {
- border: 1px dashed var(--el-border-color);
- border-radius: 6px;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- transition: var(--el-transition-duration-fast);
- }
- .avatar-uploader .el-upload:hover {
- border-color: var(--el-color-primary);
- }
- .el-icon.avatar-uploader-icon {
- display: block;
- font-size: 36px;
- color: #8c939d;
- background-color: #fafafa;
- width: 120px;
- height: 120px;
- padding-top: 30px;
- box-sizing: border-box;
- border: 1px solid #EDEDED;
- border-radius: 12px;
- text-align: center;
- }
- >p {
- width: 1110px;
- height: 75px;
- strong {
- font-weight: 500;
- color: #333333;
- padding: 0 14px;
- }
- label {
- display: inline-block;
- width: 125px;
- text-align: right;
- padding-right: 10px;
- box-sizing: border-box;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #333333;
- line-height: 19px;
- font-style: normal;
- text-transform: none;
- }
- >label::before {
- content: "*";
- display: inline-block;
- width: 10px;
- height: 2px;
- color: #fe0101;
- }
- span {
- color: #fe0101;
- display: block;
- padding-left: 135px;
- height: 30px;
- }
- .upload-demo {
- display: inline-block;
- width: 112px;
- height: 112px;
- vertical-align: -93px;
- }
- //上传图片相关样式
- .avatar-uploader .el-upload {
- border: 1px dashed var(--el-border-color);
- border-radius: 6px;
- cursor: pointer;
- position: relative;
- overflow: hidden;
- transition: var(--el-transition-duration-fast);
- }
- .avatar-uploader .el-upload:hover {
- border-color: var(--el-color-primary);
- }
- .el-icon.avatar-uploader-icon {
- font-size: 28px;
- color: #8c939d;
- width: 178px;
- height: 178px;
- text-align: center;
- }
- //上传图片相关样式 end
- :deep(.el-input__wrapper.is-focus) {
- box-shadow: 0 0 0 1px #c0c4cc;
- }
- :deep(.el-date-editor.el-input),
- :deep(.el-date-editor.el-input__wrapper) {
- height: 44px;
- width: 470px;
- }
- :deep(.el-input__inner) {
- font-size: 16px;
- }
- :deep(.el-upload-dragger) {
- padding: 0;
- margin: 0;
- border: 1px solid #ededed;
- }
- :deep(.el-upload-dragger .el-icon--upload) {
- font-size: 67px;
- line-height: 50px;
- padding: 0;
- margin: 0;
- }
- :deep(.el-upload-dragger .el-upload__text) {
- font-size: 18px;
- font-weight: 400;
- color: #999;
- text-align: center;
- margin-bottom: 14px;
- margin-top: 5px;
- }
- :deep(.el-icon svg) {
- width: 34px;
- height: 34px;
- }
- }
- }
- // 2.选择相应网站
- .textTwo {
- width: 1200px;
- overflow: hidden;
- // 页面头部搜索和按钮
- .pageTop {
- width: 1150px;
- height: 44px;
- margin: 30px 0 40px 50px;
- >.left {
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #333333;
- line-height: 19px;
- >a {
- width: 80px;
- height: 21px;
- padding-left: 30px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #47ACFF;
- line-height: 19px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- :deep(.el-select__wrapper.is-focused) {
- box-shadow: 0 0 0 1px var(--el-border-color) inset;
- }
- }
- >.right {
- button {
- width: 94px;
- height: 36px;
- line-height: 36px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #33B023;
- line-height: 19px;
- text-align: center;
- border: none;
- border-radius: 7px;
- }
- .reset {
- border: 1px solid #33B023;
- color: #33B023;
- background-color: #fff;
- margin-right: 25px;
- }
- .search {
- background-color: #33B023;
- color: #ffffff;
- }
- }
- }
- //示意图
- .my-header {
- display: flex;
- flex-direction: row;
- justify-content: space-between;
- gap: 16px;
- .el-button {
- border-radius: var(--el-border-radius-base);
- font-size: var(--el-font-size-base);
- background: #ee8787;
- border: none;
- }
- }
- .graph {
- background-color: #fff;
- padding: 40px 60px 80px;
- overflow: hidden;
- display: flex;
- li {
- float: left;
- span {
- display: inline-block;
- width: 246px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 16px;
- color: #333333;
- line-height: 30px;
- text-align: center;
- margin-bottom: 15px;
- }
- img {
- width: 246px;
- height: 344px;
- }
- }
- >li:first-child {
- margin-right: 60px;
- }
- >li:last-child {
- margin-left: 60px;
- }
- }
- // 页面中的表格
- .pageTable {
- width: 100%;
- overflow: hidden;
- padding-bottom: 60px;
- :deep(.el-checkbox__input.is-checked .el-checkbox__inner) {
- background-color: #333;
- border-color: #333;
- }
- :deep(.el-table tr) {
- background-color: #fafafa;
- height: 74px;
- }
- :deep(.el-table .cell) {
- text-align: center;
- box-sizing: border-box;
- height: 23px;
- line-height: 23px;
- overflow-wrap: break-word;
- padding: 0 12px;
- text-overflow: ellipsis;
- white-space: normal;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #333333;
- line-height: 19px;
- font-style: normal;
- text-transform: none;
- }
- }
- // 页码
- .pagination {
- display: flex;
- justify-content: center;
- // margin-top: 60px;
- margin-bottom: 90px;
- // 鼠标移入后字体颜色
- :deep(.el-pagination:hover) {
- color: #139609;
- }
- :deep(.el-pagination.is-background .btn-next),
- :deep(.el-pagination.is-background .btn-prev) {
- width: 70px;
- height: 34px;
- margin: 0px 10px;
- border-radius: 4px;
- }
- :deep(.el-pagination.is-background .el-pager li) {
- margin: 0px 10px;
- width: 38px;
- height: 34px;
- border-radius: 4px;
- }
- :deep(.el-pagination.is-background .btn-next.is-active),
- :deep(.el-pagination.is-background .btn-prev.is-active),
- :deep(.el-pagination.is-background .el-pager li.is-active) {
- background-color: #028e21;
- color: #fff;
- }
- }
- }
- // 3.提交工单信息
- .submit {
- width: 1200px;
- overflow: hidden;
- text-align: center;
- .inner {
- width: 1100px;
- padding-left: 50px;
- padding-bottom: 130px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-style: normal;
- text-transform: none;
- // 标题
- >h1 {
- margin-top: 80px;
- margin-bottom: 30px;
- font-weight: bold;
- font-size: 26px;
- color: #333333;
- line-height: 30px;
- text-align: center;
- }
- // 工单编号
- >p {
- margin-bottom: 257px;
- font-weight: 400;
- font-size: 22px;
- color: #333333;
- text-align: center;
- }
- // 按钮
- >.btn {
- margin-bottom: 30px;
- button {
- width: 134px;
- height: 50px;
- border: none;
- font-weight: 400;
- font-size: 16px;
- text-align: center;
- border-radius: 7px;
- }
- .check {
- background-color: #fff;
- color: #33B023;
- border: 1px solid #33B023;
- margin-right: 160px;
- }
- .apply {
- background-color: #33B023;
- color: #fff;
- }
- }
- // 提示文字
- >span {
- font-weight: 400;
- font-size: 14px;
- color: #999999;
- }
- }
- }
- }
- }
- }
- //工单列表
- #orderList {
- width: 1200px;
- margin: 0 auto;
- }
- }
- //广告页面底部部分
- .bottom {
- width: 1200px;
- height: 145px;
- background-color: #ecf5ee;
- padding: 0px 30px;
- margin: 0 auto;
- box-sizing: border-box;
- // display: none;
- .inner {
- width: 1200px;
- height: 145px;
- padding: 0;
- .amount {
- float: left;
- padding-top: 52px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: 400;
- font-size: 16px;
- color: #333333;
- line-height: 19px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- span {
- padding: 0 15px 0 25px;
- font-family: Microsoft YaHei, Microsoft YaHei;
- font-weight: bold;
- font-size: 24px;
- color: #028E21;
- line-height: 28px;
- text-align: left;
- font-style: normal;
- text-transform: none;
- }
- }
- .btn {
- float: right;
- margin-right: 60px;
- .btn1 {
- width: 115px;
- height: 40px;
- font-size: 16px;
- background-color: #ffffff;
- color: #028e21;
- border: 1px solid #028e21;
- border-radius: 6px;
- margin-right: 50px;
- margin-top: 53px;
- }
- .btn2 {
- width: 115px;
- height: 40px;
- font-size: 16px;
- background-color: #028e21;
- color: #ffffff;
- border: none;
- border-radius: 6px;
- margin: 53px 0;
- }
- }
- }
- }
- }
- .dialogPicBox {
- img {
- width: 1200px;
-
- }
- }
- /deep/.el-carousel__indicators .el-carousel__indicator button {
- width: 12px; /* 宽度 */
- height: 12px; /* 高度 */
- border-radius: 50%; /* 圆形 */
- background-color: #999;
- }
- /* 可选:更改当前项指示器的颜色 */
- /deep/.el-carousel__indicators .el-carousel__indicator.is-active button {
- background-color: #028e21; /* 当前项颜色 */
- }
- </style>
|