createFullscreenAd.vue 29 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. <template>
  2. <view class="page">
  3. <u-sticky :h5-nav-height="0" z-index="9099" :offset-top='0'>
  4. <uni-NavBar :headerTitle="`${headerTitle}创建`" background="#fff" :isSlot="false"></uni-NavBar>
  5. </u-sticky>
  6. <u-form :model="adForm" :rules="adrules" ref="uForm" :label-width="200"
  7. style="padding: 20rpx 24rpx 135rpx;box-sizing: border-box;">
  8. <view class="module">
  9. <text class="module-title ">基本信息</text>
  10. <u-form-item label="投放计划名称" prop="name" required>
  11. <u-input v-model="adForm.name" :custom-style="{textAlign:'right'}"
  12. placeholder="请输入...(最多20个字符)"></u-input>
  13. </u-form-item>
  14. <u-form-item label="选择广告位" prop="positionName" required :border-bottom="false">
  15. <u-input v-model="adForm.positionName" type="select" :select-open="adSlotShow"
  16. @click="adSlotShow=true" :custom-style="{textAlign:'right'}" placeholder="请选择"></u-input>
  17. </u-form-item>
  18. </view>
  19. <view class="module">
  20. <text class="module-title ">投放区域</text>
  21. <u-form-item label="省市区" prop="district" :label-width="100" required :border-bottom="false">
  22. <u-input v-model="queryTreeValue" type="select" :select-open="queryTreeShow"
  23. @click="queryTreeShow=true" :custom-style="{textAlign:'right'}" placeholder="请选择"></u-input>
  24. </u-form-item>
  25. </view>
  26. <view class="module">
  27. <text class="module-title ">投放时间</text>
  28. <u-form-item label="投放开始时间" required prop="startDate">
  29. <u-input v-model="adForm.startDate" type="select" :select-open="startDateShow"
  30. @click="startDateShow=true" :custom-style="{textAlign:'right'}" placeholder="请选择"></u-input>
  31. </u-form-item>
  32. <u-form-item label="投放结束时间" required prop="endDate">
  33. <u-input v-model="adForm.endDate" type="select" :select-open="endDateShow" @click="endDateShow=true"
  34. :custom-style="{textAlign:'right'}" placeholder="请选择"></u-input>
  35. </u-form-item>
  36. <view class="dis f-c ">
  37. <u-form-item label="生效周期" prop="validPeriodType" required
  38. :border-bottom="adForm.validPeriodType && adForm.validPeriodType!='0'? false:true">
  39. <view class="dis a-c j-end" style="width: 100%;">
  40. <view class="tab-view dis a-c j-c"
  41. :class="{'tab-view-active':adForm.validPeriodType==item.value}"
  42. v-for="(item,index) in validPeriodTypeList" :key="index"
  43. @click="validPeriodTypeSelect(item)">
  44. <text>{{item.label}}</text>
  45. </view>
  46. </view>
  47. </u-form-item>
  48. <!-- 周期策略选择 -->
  49. <u-form-item prop="validPeriodValue" :border-bottom='false'
  50. v-if="adForm.validPeriodType && adForm.validPeriodType!='0'">
  51. <view class="extendArea dis a-c f-wrap" style="padding-bottom: 0;">
  52. <view class="cycleStrategy dis a-c j-c" v-for="(item,index) in cycleStrategylist"
  53. :key="index" :class="{ 'tcycleStrategy-active': selectedDays.includes(item.value) }"
  54. @click="toggleDaySelection(item.value)">
  55. <text>{{item.label}}</text>
  56. </view>
  57. </view>
  58. </u-form-item>
  59. </view>
  60. <view class="dis f-c ">
  61. <u-form-item label="生效时段" prop="validTimeRangeType" required :border-bottom="false">
  62. <view class="dis a-c j-end" style="width: 100%;">
  63. <view class="tab-view dis a-c j-c"
  64. :class="{'tab-view-active':adForm.validTimeRangeType==item.value}"
  65. v-for="(item,index) in validTimeRangeTypeList" :key="index"
  66. @click="timeSegmentSelect(item)">
  67. <text>{{item.label}}</text>
  68. </view>
  69. </view>
  70. </u-form-item>
  71. <view class="extendArea mb-3 " style="font-size: 26rpx;" v-if="adForm.validTimeRangeType=='1'">
  72. <view class=" dis a-c j-s mb-3">
  73. <text style="color: #333;">开始时间</text>
  74. <view class="dis a-c" @click="timeSegmentStartShow=true">
  75. <text style="color: #aaa;" class="mr-1">{{timeSegmentStart|| '请选择'}}</text>
  76. <u-icon name="arrow-right" color="#979797" size="26"></u-icon>
  77. </view>
  78. </view>
  79. <view class=" dis a-c j-s ">
  80. <text style="color: #333;">开始时间</text>
  81. <view class="dis a-c" @click="timeSegmentEndShow=true">
  82. <text style="color: #aaa;" class="mr-1">{{timeSegmentEnd || "请选择"}}</text>
  83. <u-icon name="arrow-right" color="#979797" size="26"></u-icon>
  84. </view>
  85. </view>
  86. </view>
  87. </view>
  88. </view>
  89. <view class="module">
  90. <text class="module-title ">投放内容</text>
  91. <!-- 图片上传 -->
  92. <view class="fileUpload ">
  93. <view class="tabs dis a-end" v-if="tabList.length>1">
  94. <view v-for="(item, index) in tabList" :key="index" class="tab dis a-c j-c" :class="{
  95. active: fileUploadActiveTab === index,
  96. tab1: fileUploadActiveTab !== index,
  97. left: fileUploadActiveTab === 0,
  98. right: fileUploadActiveTab === 1
  99. }" @click="handleTab(index,item)">
  100. <view class="tabtitle">
  101. <view class="">
  102. {{ item.label }}
  103. </view>
  104. </view>
  105. </view>
  106. </view>
  107. <view class="fileUploadView" v-if="adForm.imageType=='1'">
  108. <view class="p-2" v-show="imgFileList.length>0">
  109. <u-upload ref="Upload" :file-list="imgFileList" :action="action"
  110. @on-list-change="onListChange" @on-success="detailsSuccess" :source-type="['album']"
  111. width="150" height="150">
  112. </u-upload>
  113. </view>
  114. <view class="default dis f-c a-c j-c " @click="triggerUpload" v-if="!imgFileList.length">
  115. <image src="/static/ad/ggtp.png" mode=""></image>
  116. <text class="title">请上传广告图片</text>
  117. <text>
  118. 尺寸建议:建议图片1125*2436px,支持jpg、png格式,体积小于1Mb。因手机分辨率问题,部分机型可能图片展示不全,重要信息尽量展示在图片中部。
  119. </text>
  120. </view>
  121. </view>
  122. <view class="fileUploadView" v-if="adForm.imageType=='2'">
  123. <view class="p-2 dis f-c " v-if="adForm.taskImage">
  124. <video id="myVideo" :src="adForm.taskImage" :style="{width:'100%',height:'330rpx'}"
  125. :muted="false" :enable-progress-gesture="true">
  126. </video>
  127. <view class="dis a-c j-end mt-2" style="width: 100%;">
  128. <u-button size="medium" type="primary" plain style="margin-left: auto;"
  129. @click="videoDel">删除</u-button>
  130. </view>
  131. </view>
  132. <view class="default dis f-c a-c j-c " @click="uploadVideo" v-else>
  133. <image src="/static/ad/ggsp.png" mode=""></image>
  134. <text class="title">请上传广告视频</text>
  135. <text>尺寸建议:画面比例9:16,支持MP4格式,时长小于等于30秒。因手机分辨率问题,部分机型可能画面展示不全,重要信息尽量展示在画面中部。</text>
  136. </view>
  137. </view>
  138. </view>
  139. </view>
  140. <view class="module" v-if="adPricingModelList.length>0">
  141. <text class="module-title">计费方式</text>
  142. <u-radio-group v-model="adForm.relId" :wrap="true" active-color="#4B9DFF">
  143. <view class="dis a-c j-c BillingModelView" v-for="(item, index) in adPricingModelList" :key="index">
  144. <u-radio :name="item.id" label-size="26">
  145. <text style="margin-right: 60rpx;">{{item.pricingName}}</text>
  146. <text>{{ item.amount }} {{ item.pricingUnit }}</text>
  147. </u-radio>
  148. </view>
  149. </u-radio-group>
  150. </view>
  151. <view class="module">
  152. <text class="module-title ">投放频次</text>
  153. <view class="deliveryFrequency dis a-c ">
  154. <view class="title">每人每天展示次数</view>
  155. <u-radio-group v-model="userDailyImpCount" @change="userDailyImpCountChange" active-color="#4B9DFF">
  156. <u-radio name="1" label-size="26">不限</u-radio>
  157. <u-radio name="2" label-size="26">限制</u-radio>
  158. </u-radio-group>
  159. <view class="dis a-c flex-1" v-if="userDailyImpCount=='2'">
  160. <u-input v-model="adForm.userDailyDisplayLimit" :custom-style="{width:'100rpx',minHeight:'0'}"
  161. placeholder="请输入"></u-input>
  162. <text>次</text>
  163. </view>
  164. </view>
  165. <view class="deliveryFrequency dis a-c ">
  166. <view class="title">每人展示次数</view>
  167. <u-radio-group v-model="userImpCount" @change="userImpCountChange" active-color="#4B9DFF">
  168. <u-radio name="1" label-size="26">不限</u-radio>
  169. <u-radio name="2" label-size="26">限制</u-radio>
  170. </u-radio-group>
  171. <view class="dis a-c flex-1" v-if="userImpCount=='2'">
  172. <u-input v-model="adForm.userTotalDisplayLimit" :custom-style="{width:'50rpx',minHeight:'0'}"
  173. placeholder="请输入"></u-input>
  174. <text>次</text>
  175. </view>
  176. </view>
  177. <view class="deliveryFrequency dis a-c ">
  178. <view class="title">展示时间间隔</view>
  179. <u-radio-group v-model="displayTimeInterval" @change="displayTimeIntervalChange"
  180. active-color="#4B9DFF">
  181. <u-radio name="1" label-size="26">不限</u-radio>
  182. <u-radio name="2" label-size="26">限制</u-radio>
  183. </u-radio-group>
  184. <view class="dis a-c flex-1" v-if="displayTimeInterval=='2'">
  185. <u-input v-model="adForm.showInterval" :custom-style="{width:'50rpx',minHeight:'0'}"
  186. placeholder="请输入"></u-input>
  187. <text>分钟</text>
  188. </view>
  189. </view>
  190. </view>
  191. <view class="module">
  192. <text class="module-title ">广告预算</text>
  193. <u-form-item label="广告预算" prop="adBudget" required :border-bottom="false">
  194. <u-input v-model="adForm.adBudget" :custom-style="{textAlign:'right'}"></u-input>
  195. <text class="ml-1">元</text>
  196. </u-form-item>
  197. <text class="mb-3" style="font-size: 22rpx;color: #aaa;">为保证广告正常投放,请保证余额账户有充足余额,余额不足时,广告 将自动暂停投放。</text>
  198. </view>
  199. </u-form>
  200. <view class="footer-view">
  201. <view class="dis a-c j-c " @click="submit">
  202. 提交审核
  203. </view>
  204. </view>
  205. <!-- 省市区 -->
  206. <u-select v-model="queryTreeShow" mode="mutil-column-auto" label-name="areaCname" value-name="areaCode"
  207. child-name="children" :list="queryTreeList" @confirm="queryTreeConfirm"></u-select>
  208. <!-- 广告位 -->
  209. <u-select v-model="adSlotShow" mode="single-column" label-name="positionName" value-name="id" :list="adSlotList"
  210. @confirm="adSlotConfirm"></u-select>
  211. <!-- 投放日期 -->
  212. <u-calendar v-model="startDateShow" mode="date" @change="startDateChange" max-date="2050-12-31"></u-calendar>
  213. <u-calendar v-model="endDateShow" mode="date" @change="endDateChange" max-date="2050-12-31"></u-calendar>
  214. <!-- 投放时间 -->
  215. <u-picker v-model="timeSegmentStartShow" mode="time" :params="params"
  216. @confirm="timeSegmentStartConfirm"></u-picker>
  217. <u-picker v-model="timeSegmentEndShow" mode="time" :params="params" @confirm="timeSegmentEndConfirm"></u-picker>
  218. <!-- 自定义加载动画 -->
  219. <u-mask :show="lodingShow" style="background-color: rgba(255, 255, 255, 0.6);">
  220. <view class="dis a-c j-c " style="height: 100%;">
  221. <u-loading mode="circle"></u-loading>
  222. </view>
  223. </u-mask>
  224. </view>
  225. </template>
  226. <script>
  227. import {
  228. ACCESS_TOKEN,
  229. USER_INFO
  230. } from '@/common/util/constants.js'
  231. import configService from '@/common/service/config.service'
  232. export default {
  233. data() {
  234. return {
  235. adSlotPriceList: [], //价格列表
  236. adPricingModelList: [], //计费模式列表
  237. queryTreeList: [], //省市区optinos
  238. adSlotList: [], //广告位options
  239. queryTreeValue: "", //省市区回显
  240. lodingShow: false, //loding组件
  241. startDateShow: false, //开始日期选择
  242. endDateShow: false, //结束日期选择
  243. queryTreeShow: false, //省市区选择
  244. adSlotShow: false, //广告位选择
  245. timeSegmentStartShow: false, //开始时间
  246. timeSegmentEndShow: false, //结果时间
  247. params: {
  248. year: false,
  249. month: false,
  250. day: false,
  251. hour: true,
  252. minute: true,
  253. second: true
  254. },
  255. value: 'orange',
  256. value1: "",
  257. adForm: {
  258. id: "",
  259. name: '', //投放计划名称
  260. positionId: null, //广告位id
  261. positionName: "", //广告位name
  262. startDate: "", //投放开始时间
  263. endDate: "", //投放结束时间
  264. province: "", //省
  265. provinceCode: "",
  266. city: "", //市
  267. cityCode: "",
  268. district: "", //区
  269. districtCode: "",
  270. street: "", //街道
  271. streetCode: "",
  272. validPeriodType: "", //生效周期
  273. validPeriodValue: "", //周期策略
  274. validTimeRangeType: "", //生效时段类型
  275. validTimeRangeValue: "", //生效时段值
  276. relId: "", //计费方式
  277. userDailyDisplayLimit: "", //每人每天展示次数
  278. userTotalDisplayLimit: "", //每人总次数
  279. showInterval: "", //展示时间间隔
  280. taskImage: "", //文件路径
  281. imageType: "1", //文件类型
  282. type: "", //广告类型
  283. adBudget: "", //广告预算
  284. merchantId: "", //商户id
  285. merchantName: "", //商户name
  286. },
  287. timeSegmentStart: "", //生效时段开始
  288. timeSegmentEnd: "", //生效时段结束
  289. userDailyImpCount: "1",
  290. userImpCount: "1",
  291. displayTimeInterval: "1",
  292. adrules: {
  293. name: [{
  294. required: true,
  295. message: '请输入名称',
  296. trigger: ['change', 'blur'],
  297. }],
  298. positionName: [{
  299. required: true,
  300. message: '请选择广告位',
  301. trigger: ['change', 'blur'],
  302. }],
  303. district: [{
  304. required: true,
  305. message: '请选择投放区域',
  306. trigger: ['change', 'blur'],
  307. }],
  308. startDate: [{
  309. required: true,
  310. message: '时间必选',
  311. trigger: ['change', 'blur'],
  312. }],
  313. endDate: [{
  314. required: true,
  315. message: '时间必选',
  316. trigger: ['change', 'blur'],
  317. }],
  318. validPeriodType: [{
  319. required: true,
  320. message: '生效周期必选',
  321. trigger: ['blur'],
  322. }],
  323. validTimeRangeType: [{
  324. required: true,
  325. message: '生效时段必传',
  326. trigger: ['blur'],
  327. }],
  328. adBudget: [{
  329. required: true,
  330. message: '广告预算必填',
  331. trigger: ['blur'],
  332. }],
  333. taskImage: [{
  334. required: true,
  335. message: '投放内容必传',
  336. trigger: ['change'],
  337. }],
  338. validPeriodValue: [{
  339. required: true,
  340. message: '生效周期至少选择一天',
  341. trigger: ['change'],
  342. }],
  343. },
  344. weekList: [], //周
  345. monthList: [], //月
  346. selectedDays: [], //周期策略选中日期
  347. timeSegment: "", //生效时段
  348. validTimeRangeTypeList: [{
  349. label: "全天",
  350. value: "0",
  351. },
  352. {
  353. label: "指定时间段",
  354. value: "1",
  355. },
  356. ],
  357. //生效周期
  358. validPeriodTypeList: [{
  359. label: "每天",
  360. value: "0",
  361. },
  362. {
  363. label: "每周",
  364. value: "1",
  365. },
  366. {
  367. label: "每月",
  368. value: "2",
  369. }
  370. ],
  371. tabList: [],
  372. fileUploadActiveTab: 0,
  373. //文件回显列表
  374. imgFileList: [], //图片数组
  375. action: configService.apiUrl + '/sys/common/upload', //图片上传地址
  376. token: "",
  377. userInfo: {},
  378. headerTitle: "", //页面标题
  379. }
  380. },
  381. onShow() {},
  382. async onLoad(options) {
  383. if (options.adType) {
  384. this.adForm.type = options.adType;
  385. const map = {
  386. '0': '全屏广告',
  387. '1': '弹窗广告',
  388. '2': '轮播广告',
  389. '3': '页面嵌入广告',
  390. }
  391. this.headerTitle = map[this.adForm.type] || ''
  392. }
  393. if (options.id) {
  394. this.$http.get('advert/localAdvertTask/queryById?id=' + options.id).then(res => {
  395. if (res.data.code == '200') {
  396. delete res.data.result.adPositionPriceRel
  397. delete res.data.result.createBy;
  398. delete res.data.result.createTime;
  399. delete res.data.result.isDelete;
  400. delete res.data.result.updateBy;
  401. delete res.data.result.updateTime;
  402. this.adForm = res.data.result
  403. this.queryTreeValue =
  404. `${this.adForm.province}-${this.adForm.city}-${this.adForm.district}-${this.adForm.street}`;
  405. this.getadBillingModel();
  406. this.selectedDays = this.adForm.validPeriodValue.split(',')
  407. let list = this.adForm.validTimeRangeValue.split(',');
  408. this.timeSegmentStart = list[0];
  409. this.timeSegmentEnd = list[1];
  410. let imglist = this.adForm.taskImage.split(",")
  411. this.imgFileList = imglist.map(val => {
  412. return {
  413. url: val
  414. }
  415. })
  416. if (this.adForm.userDailyDisplayLimit) {
  417. this.userDailyImpCount = '2';
  418. }
  419. if (this.adForm.userTotalDisplayLimit) {
  420. this.userImpCount = '2';
  421. }
  422. if (this.adForm.showInterval) {
  423. this.displayTimeInterval = '2';
  424. }
  425. this.adForm.validTimeRangeType = this.adForm.validTimeRangeType + '';
  426. this.adForm.validPeriodType = this.adForm.validPeriodType + '';
  427. this.adForm.adBudget = this.adForm.adBudget + '';
  428. console.log(this.adForm);
  429. }
  430. })
  431. }
  432. this.token = uni.getStorageSync(ACCESS_TOKEN);
  433. this.userInfo = uni.getStorageSync(USER_INFO);
  434. this.adForm.merchantId = this.userInfo.merchantId;
  435. this.adForm.merchantName = this.userInfo.merchantName;
  436. await this.queryTree(); //获取省市区数据
  437. await this.queryAdSlot(); // 获取广告位数据
  438. this.generateWeek();
  439. this.generatemonth();
  440. },
  441. onReady() {
  442. this.$refs.uForm.setRules(this.adrules);
  443. },
  444. computed: {
  445. //区分月和周
  446. cycleStrategylist() {
  447. return this.adForm.validPeriodType == '1' ? this.weekList : this.monthList;
  448. }
  449. },
  450. methods: {
  451. submit() {
  452. if (this.adForm.validTimeRangeType == '1' && this.timeSegmentStart && this.timeSegmentEnd) {
  453. this.adForm.validTimeRangeValue = this.timeSegmentStart + "," + this.timeSegmentEnd;
  454. }
  455. console.log(this.adForm);
  456. this.$refs.uForm.validate(valid => {
  457. if (valid) {
  458. if (!this.adForm.taskImage) {
  459. return uni.showToast({
  460. title: "素材不能为空",
  461. icon: 'none'
  462. })
  463. }
  464. if (!this.timeSegmentStart && this.timeSegmentEnd) {
  465. return uni.showToast({
  466. title: "生效时间段补充完整",
  467. icon: 'none'
  468. })
  469. }
  470. if (this.adForm.id) {
  471. this.$http.post('advert/localAdvertTask/merchantEdit', this.adForm).then(res => {
  472. if (res.data.code == '200') {
  473. uni.showToast({
  474. title: res.data.message,
  475. icon: "none"
  476. })
  477. uni.navigateBack({
  478. delta: 1
  479. });
  480. }
  481. })
  482. } else {
  483. this.$http.post('advert/localAdvertTask/merchantAdd', this.adForm).then(res => {
  484. if (res.data.code == '200') {
  485. uni.showToast({
  486. title: res.data.message,
  487. icon: "none"
  488. })
  489. uni.navigateBack({
  490. delta: 1
  491. });
  492. }
  493. })
  494. }
  495. } else {
  496. console.log('验证失败');
  497. }
  498. });
  499. },
  500. videoDel() {
  501. this.adForm.taskImage = "";
  502. },
  503. //视频上传
  504. async uploadVideo(type, imageIdList, imgurl) {
  505. let [chooseImageErr, chooseImageRes] = await uni.chooseVideo({
  506. sourceType: ['album']
  507. });
  508. if (chooseImageRes) {
  509. uni.uploadFile({
  510. url: configService.apiUrl + '/sys/common/upload',
  511. name: "file",
  512. file: chooseImageRes.tempFile,
  513. header: {
  514. Authorization: this.token,
  515. },
  516. success: async (Res) => {
  517. let data = JSON.parse(Res.data);
  518. this.adForm.taskImage = configService.apiUrl + '/' + data.message;
  519. console.log(this.adForm.taskImage);
  520. },
  521. });
  522. }
  523. },
  524. triggerUpload() {
  525. this.$refs.Upload.selectFile(); // ref调用文件选择*****************************
  526. },
  527. //图片上传事件
  528. detailsSuccess(res, index, lists) {
  529. const fileList = lists.map((file) => {
  530. if (file.response) {
  531. // 拼接地址前缀
  532. file.url = configService.apiUrl + '/' + file.response.message;
  533. }
  534. return file.url;
  535. });
  536. this.adForm.taskImage = fileList.join(",") //图片地址逗号拼接
  537. this.imgFileList = lists;
  538. },
  539. //图片多选上传
  540. onListChange(lists) {
  541. },
  542. handleTab(index, item) {
  543. this.fileUploadActiveTab = index
  544. this.adForm.imageType = item.value;
  545. this.adForm.taskImage = "";
  546. this.imgFileList = [];
  547. },
  548. getadBillingModel() {
  549. this.$http.get('/adPricingPrice/queryPageList', {
  550. params: {
  551. adPositionId: this.adForm.positionId,
  552. city: this.adForm.cityCode,
  553. pageNo: 1,
  554. pageSize: 1000,
  555. }
  556. }).then(res => {
  557. if (res.data.result.records.length > 0) {
  558. this.adSlotPriceList = res.data.result.records[0]?.adPositionPriceRelList;
  559. this.$http.get('/adPricingModel/queryPageList', {
  560. params: {
  561. pageNo: 1,
  562. pageSize: 1000,
  563. isDelete: 0,
  564. }
  565. }).then(res => {
  566. const pricingUnitMap = {
  567. "1": "元/点击",
  568. "2": "元/天",
  569. "3": "元/笔销售",
  570. "4": "元/千次曝光",
  571. }
  572. this.adPricingModelList = res.data.result.records.map(val => {
  573. return {
  574. adPricingModelId: val.id,
  575. pricingName: val.pricingName,
  576. pricingUnit: pricingUnitMap[val.pricingUnit],
  577. checked: false,
  578. amount: "",
  579. }
  580. })
  581. const result = this.adPricingModelList.map(model => {
  582. const matchedPrice = this.adSlotPriceList.find(price => price
  583. .adPricingModelId === model.adPricingModelId);
  584. return {
  585. ...model,
  586. amount: matchedPrice ? matchedPrice.amount : model.amount,
  587. checked: false,
  588. id: matchedPrice?.id,
  589. };
  590. }).filter(val => val.amount)
  591. this.adPricingModelList = result;
  592. })
  593. } else {
  594. uni.showToast({
  595. icon: "none",
  596. title: "该区域暂无计费模式相关配置"
  597. })
  598. }
  599. })
  600. },
  601. queryAdSlot() {
  602. this.$http.get('/adPosition/queryPageList').then(res => {
  603. if (res.data.code == 200) {
  604. if (res.data.code == 200) {
  605. this.adSlotList = res.data.result.records
  606. console.log(res.data.result);
  607. }
  608. }
  609. })
  610. },
  611. queryTree() {
  612. this.lodingShow = true;
  613. this.$http.post('/sys/area/queryTree').then(res => {
  614. if (res.data.code == 200) {
  615. console.log(res);
  616. this.queryTreeList = res.data.result
  617. this.lodingShow = false;
  618. }
  619. })
  620. },
  621. //省市区选择事件
  622. queryTreeConfirm(value) {
  623. this.queryTreeValue = `${value[0].label}-${value[1].label}-${value[2].label}-${value[3].label}`
  624. this.adForm.provinceCode = value[0].value;
  625. this.adForm.cityCode = value[1].value;
  626. this.adForm.districtCode = value[2].value;
  627. this.adForm.streetCode = value[3].value;
  628. this.adForm.province = value[0].label;
  629. this.adForm.city = value[1].label;
  630. this.adForm.district = value[2].label;
  631. this.adForm.street = value[3].label;
  632. this.getadBillingModel() //获取计费方式
  633. },
  634. //广告位选择后续操作
  635. adSlotConfirm(value) {
  636. let info = this.adSlotList.find(val => val.id == value[0].value).supportMaterial.split(','); //获取投放内容类型
  637. if (info.length > 1) {
  638. this.tabList = info.map(val => {
  639. return {
  640. label: val == 1 ? '图片' : '视频',
  641. value: val
  642. }
  643. })
  644. } else {
  645. this.tabList = [];
  646. }
  647. this.adForm.imageType = info[0];
  648. this.adForm.positionId = value[0].value;
  649. this.adForm.positionName = value[0].label;
  650. },
  651. //日期选择
  652. startDateChange(e) {
  653. this.adForm.startDate = e.result + " 00:00:00"
  654. },
  655. endDateChange(e) {
  656. this.adForm.endDate = e.result + " 23:59:59"
  657. },
  658. // 时间选择
  659. timeSegmentStartConfirm(value) {
  660. this.timeSegmentStart = `${value.hour}:${value.minute}:${value.second}`
  661. },
  662. timeSegmentEndConfirm(value) {
  663. this.timeSegmentEnd = `${value.hour}:${value.minute}:${value.second}`
  664. },
  665. userDailyImpCountChange(value) {
  666. if (value == 1) {
  667. this.adForm.userDailyDisplayLimit = ' ';
  668. } else {
  669. this.adForm.userDailyDisplayLimit = '';
  670. }
  671. },
  672. userImpCountChange(value) {
  673. if (value == 1) {
  674. this.adForm.userTotalDisplayLimit = ' ';
  675. } else {
  676. this.adForm.userTotalDisplayLimit = '';
  677. }
  678. },
  679. displayTimeIntervalChange(value) {
  680. if (value == 1) {
  681. this.adForm.showInterval = ' ';
  682. } else {
  683. this.adForm.showInterval = '';
  684. }
  685. },
  686. //周列表
  687. generateWeek() {
  688. const weekList = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((val, index) => {
  689. return {
  690. label: val,
  691. value: (index + 1).toString()
  692. }
  693. })
  694. this.weekList = weekList;
  695. },
  696. // 月列表
  697. generatemonth() {
  698. const monthList = Array.from({
  699. length: 31
  700. }, (_, index) => {
  701. const value = (index + 1).toString();
  702. return {
  703. label: value,
  704. value
  705. };
  706. });
  707. this.monthList = monthList;
  708. },
  709. // 周期策略选择
  710. toggleDaySelection(dayValue) {
  711. const index = this.selectedDays.indexOf(dayValue);
  712. if (index > -1) {
  713. // 如果找到,移除该元素
  714. this.selectedDays.splice(index, 1);
  715. } else {
  716. // 如果未找到,添加该元素
  717. this.selectedDays.push(dayValue);
  718. }
  719. this.adForm.validPeriodValue = this.selectedDays.join(',')
  720. },
  721. //生效周期选择
  722. validPeriodTypeSelect(item) {
  723. this.adForm.validPeriodType = item.value
  724. this.selectedDays = [];
  725. },
  726. timeSegmentSelect(item) {
  727. this.adForm.validTimeRangeType = item.value
  728. if (item.value == 0) {
  729. this.adForm.validTimeRangeValue = "00:00:00,23:59:59"
  730. } else {
  731. this.adForm.validTimeRangeValue = "";
  732. this.timeSegmentStart = "";
  733. this.timeSegmentEnd = "";
  734. }
  735. }
  736. }
  737. }
  738. </script>
  739. <style lang="scss" scoped>
  740. .page {
  741. background-color: #F7F8FC;
  742. }
  743. .module {
  744. width: 100%;
  745. background: #FFFFFF;
  746. border-radius: 10rpx;
  747. padding: 30rpx 30rpx 0;
  748. box-sizing: border-box;
  749. margin-bottom: 20rpx;
  750. display: flex;
  751. flex-direction: column;
  752. .module-title {
  753. font-size: 34rpx;
  754. color: #333;
  755. font-weight: bold;
  756. }
  757. .tab-view {
  758. background: #FFFFFF;
  759. border-radius: 10rpx;
  760. border: 1px solid #E5E5E5;
  761. font-size: 26rpx;
  762. color: #333;
  763. padding: 10rpx 32rpx;
  764. box-sizing: border-box;
  765. margin-left: 20rpx;
  766. text {
  767. line-height: 1;
  768. }
  769. }
  770. .tab-view-active {
  771. background: #E0EDFF;
  772. color: #006DFF;
  773. border: 1rpx solid #E0EDFF;
  774. }
  775. .extendArea {
  776. padding: 20rpx 20rpx;
  777. box-sizing: border-box;
  778. background: #F6F8FC;
  779. border-radius: 10rpx;
  780. }
  781. .cycleStrategy {
  782. min-width: 100rpx;
  783. background: #FFFFFF;
  784. border-radius: 10rpx;
  785. border: 1px solid #E5E5E5;
  786. font-size: 26rpx;
  787. color: #333;
  788. padding: 10rpx 32rpx;
  789. box-sizing: border-box;
  790. margin-left: 20rpx;
  791. margin-bottom: 20rpx;
  792. text {
  793. line-height: 1;
  794. }
  795. }
  796. .tcycleStrategy-active {
  797. background: #E0EDFF;
  798. color: #006DFF;
  799. border: 1rpx solid #E0EDFF;
  800. }
  801. //计费模式
  802. .BillingModelView {
  803. width: 100%;
  804. border-bottom: 1rpx solid #eee;
  805. padding: 32rpx 0;
  806. box-sizing: border-box;
  807. }
  808. .deliveryFrequency {
  809. padding: 32rpx 0;
  810. box-sizing: border-box;
  811. border-bottom: 1rpx solid #eee;
  812. .title {
  813. font-size: 26rpx;
  814. color: #333;
  815. width: 250rpx;
  816. }
  817. }
  818. .deliveryFrequency:last-child {
  819. border-bottom: none;
  820. }
  821. }
  822. ::v-deep {
  823. .u-radio__label {
  824. color: #333;
  825. }
  826. // 图片上传预览视图层级提升
  827. }
  828. .uni-system-preview-image {
  829. background: #4B9DFF !important;
  830. z-index: 9999 !important;
  831. }
  832. .footer-view {
  833. z-index: 99;
  834. position: fixed;
  835. bottom: 0;
  836. left: 0;
  837. right: 0;
  838. background-color: #fff;
  839. padding: 17rpx 24rpx;
  840. box-sizing: border-box;
  841. box-shadow: 0rpx 0rpx 12rpx 1rpx rgba(225, 225, 225, 0.3);
  842. >view {
  843. width: 100%;
  844. padding: 26rpx;
  845. box-sizing: border-box;
  846. background: #4B9DFF;
  847. border-radius: 40rpx;
  848. font-size: 30rpx;
  849. color: #fff;
  850. }
  851. }
  852. .fileUpload {
  853. position: relative;
  854. width: 100%;
  855. margin: 0 auto;
  856. box-sizing: border-box;
  857. border-radius: 0px 10rpx 10rpx 10rpx;
  858. margin: 30rpx 0;
  859. .tabs {
  860. display: flex;
  861. position: relative;
  862. overflow: hidden;
  863. border-radius: 10rpx 10rpx 0 0;
  864. }
  865. .tab {
  866. flex: 1;
  867. height: 70rpx;
  868. color: #333;
  869. font-size: 30rpx;
  870. position: relative;
  871. border-top-right-radius: 10rpx;
  872. border-top-left-radius: 10rpx;
  873. &.active {
  874. background: #F6F8FC;
  875. color: #006DFF;
  876. font-size: 30rpx;
  877. border-top-right-radius: 10rpx;
  878. border-top-left-radius: 10rpx;
  879. }
  880. &.left.active {
  881. border-top-right-radius: 0;
  882. &::after {
  883. content: "";
  884. position: absolute;
  885. top: 0;
  886. right: -50px;
  887. height: 100%;
  888. width: 50px;
  889. z-index: 2;
  890. background-color: #F6F8FC;
  891. clip-path: path("M0 0 C13.5 0 13.5 25 25 45 L0 50 Z");
  892. }
  893. }
  894. // 右侧标签的曲线
  895. &.right.active {
  896. border-top-left-radius: 0;
  897. &::before {
  898. content: "";
  899. position: absolute;
  900. top: 0;
  901. left: -49px;
  902. height: 100%;
  903. width: 50px;
  904. z-index: 2;
  905. background-color: #F6F8FC;
  906. clip-path: path("M50 0 C37.5 0 37.5 25 25 45 L50 50 Z");
  907. }
  908. }
  909. }
  910. .tab1 {
  911. flex: 1;
  912. height: 70rpx;
  913. position: relative;
  914. border-top-right-radius: 10rpx;
  915. border-top-left-radius: 10rpx;
  916. background-color: #EBF2FA;
  917. }
  918. // 文件区域样式
  919. .tabtitle {
  920. position: relative;
  921. z-index: 1; // 父级降低层级
  922. font-size: 28rpx;
  923. }
  924. }
  925. .fileUploadView {
  926. width: 100%;
  927. background-color: #F6F8FC;
  928. border-radius: 10rpx 10rpx 10rpx 10rpx;
  929. min-height: 330rpx;
  930. .default {
  931. min-height: 330rpx;
  932. padding: 30rpx 40rpx;
  933. box-sizing: border-box;
  934. image {
  935. width: 83rpx;
  936. height: 74rpx;
  937. }
  938. text {
  939. font-size: 26rpx;
  940. color: #333;
  941. }
  942. .title {
  943. margin: 15rpx 0 40rpx;
  944. }
  945. text:last-child {
  946. font-size: 22rpx;
  947. color: #aaa;
  948. }
  949. }
  950. }
  951. </style>