createFullscreenAd.vue 29 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996
  1. <template>
  2. <view class="page">
  3. <u-sticky :h5-nav-height="0" z-index="9099" :offset-top='0'>
  4. <uni-NavBar 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="child" :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. }
  379. },
  380. onShow() {},
  381. async onLoad(options) {
  382. if (options.type) {
  383. this.adForm.type = options.adType;
  384. }
  385. if (options.id) {
  386. this.$http.get('advert/localAdvertTask/queryById?id=' + options.id).then(res => {
  387. if (res.data.code == '200') {
  388. delete res.data.result.adPositionPriceRel
  389. delete res.data.result.createBy;
  390. delete res.data.result.createTime;
  391. delete res.data.result.isDelete;
  392. delete res.data.result.updateBy;
  393. delete res.data.result.updateTime;
  394. this.adForm = res.data.result
  395. this.queryTreeValue =
  396. `${this.adForm.province}-${this.adForm.city}-${this.adForm.district}-${this.adForm.street}`;
  397. this.getadBillingModel();
  398. this.selectedDays = this.adForm.validPeriodValue.split(',')
  399. let list = this.adForm.validTimeRangeValue.split(',');
  400. this.timeSegmentStart = list[0];
  401. this.timeSegmentEnd = list[1];
  402. let imglist = this.adForm.taskImage.split(",")
  403. this.imgFileList = imglist.map(val => {
  404. return {
  405. url: val
  406. }
  407. })
  408. if (this.adForm.userDailyDisplayLimit) {
  409. this.userDailyImpCount = '2';
  410. }
  411. if (this.adForm.userTotalDisplayLimit) {
  412. this.userImpCount = '2';
  413. }
  414. if (this.adForm.showInterval) {
  415. this.displayTimeInterval = '2';
  416. }
  417. this.adForm.validTimeRangeType = this.adForm.validTimeRangeType + '';
  418. this.adForm.validPeriodType = this.adForm.validPeriodType + '';
  419. this.adForm.adBudget = this.adForm.adBudget + '';
  420. console.log(this.adForm);
  421. }
  422. })
  423. }
  424. this.token = uni.getStorageSync(ACCESS_TOKEN);
  425. this.userInfo = uni.getStorageSync(USER_INFO);
  426. this.adForm.merchantId = this.userInfo.merchantId;
  427. this.adForm.merchantName = this.userInfo.merchantName;
  428. await this.queryTree(); //获取省市区数据
  429. await this.queryAdSlot(); // 获取广告位数据
  430. this.generateWeek();
  431. this.generatemonth();
  432. },
  433. onReady() {
  434. this.$refs.uForm.setRules(this.adrules);
  435. },
  436. computed: {
  437. //区分月和周
  438. cycleStrategylist() {
  439. return this.adForm.validPeriodType == '1' ? this.weekList : this.monthList;
  440. }
  441. },
  442. methods: {
  443. submit() {
  444. if (this.adForm.validTimeRangeType == '1' && this.timeSegmentStart && this.timeSegmentEnd) {
  445. this.adForm.validTimeRangeValue = this.timeSegmentStart + "," + this.timeSegmentEnd;
  446. }
  447. console.log(this.adForm);
  448. this.$refs.uForm.validate(valid => {
  449. if (valid) {
  450. if (!this.adForm.taskImage) {
  451. return uni.showToast({
  452. title: "素材不能为空",
  453. icon: 'none'
  454. })
  455. }
  456. if (!this.timeSegmentStart && this.timeSegmentEnd) {
  457. return uni.showToast({
  458. title: "生效时间段补充完整",
  459. icon: 'none'
  460. })
  461. }
  462. if (this.adForm.id) {
  463. this.$http.post('advert/localAdvertTask/merchantEdit', this.adForm).then(res => {
  464. if (res.data.code == '200') {
  465. uni.showToast({
  466. title: res.data.message,
  467. icon: "none"
  468. })
  469. uni.navigateBack({
  470. delta: 1
  471. });
  472. }
  473. })
  474. } else {
  475. this.$http.post('advert/localAdvertTask/merchantAdd', this.adForm).then(res => {
  476. if (res.data.code == '200') {
  477. uni.showToast({
  478. title: res.data.message,
  479. icon: "none"
  480. })
  481. uni.navigateBack({
  482. delta: 1
  483. });
  484. }
  485. })
  486. }
  487. } else {
  488. console.log('验证失败');
  489. }
  490. });
  491. },
  492. videoDel() {
  493. this.adForm.taskImage = "";
  494. },
  495. //视频上传
  496. async uploadVideo(type, imageIdList, imgurl) {
  497. let [chooseImageErr, chooseImageRes] = await uni.chooseVideo({
  498. sourceType: ['album']
  499. });
  500. if (chooseImageRes) {
  501. uni.uploadFile({
  502. url: configService.apiUrl + '/sys/common/upload',
  503. name: "file",
  504. file: chooseImageRes.tempFile,
  505. header: {
  506. Authorization: this.token,
  507. },
  508. success: async (Res) => {
  509. let data = JSON.parse(Res.data);
  510. this.adForm.taskImage = configService.apiUrl + '/' + data.message;
  511. console.log(this.adForm.taskImage);
  512. },
  513. });
  514. }
  515. },
  516. triggerUpload() {
  517. this.$refs.Upload.selectFile(); // ref调用文件选择*****************************
  518. },
  519. //图片上传事件
  520. detailsSuccess(res, index, lists) {
  521. const fileList = lists.map((file) => {
  522. if (file.response) {
  523. // 拼接地址前缀
  524. file.url = configService.apiUrl + '/' + file.response.message;
  525. }
  526. return file.url;
  527. });
  528. this.adForm.taskImage = fileList.join(",") //图片地址逗号拼接
  529. this.imgFileList = lists;
  530. },
  531. //图片多选上传
  532. onListChange(lists) {
  533. },
  534. handleTab(index, item) {
  535. this.fileUploadActiveTab = index
  536. this.adForm.imageType = item.value;
  537. this.adForm.taskImage = "";
  538. this.imgFileList = [];
  539. },
  540. getadBillingModel() {
  541. this.$http.get('/adPricingPrice/queryPageList', {
  542. params: {
  543. adPositionId: this.adForm.positionId,
  544. city: this.adForm.cityCode,
  545. pageNo: 1,
  546. pageSize: 1000,
  547. }
  548. }).then(res => {
  549. if (res.data.result.records.length > 0) {
  550. this.adSlotPriceList = res.data.result.records[0]?.adPositionPriceRelList;
  551. this.$http.get('/adPricingModel/queryPageList', {
  552. params: {
  553. pageNo: 1,
  554. pageSize: 1000,
  555. isDelete: 0,
  556. }
  557. }).then(res => {
  558. const pricingUnitMap = {
  559. "1": "元/点击",
  560. "2": "元/天",
  561. "3": "元/笔销售",
  562. "4": "元/千次曝光",
  563. }
  564. this.adPricingModelList = res.data.result.records.map(val => {
  565. return {
  566. adPricingModelId: val.id,
  567. pricingName: val.pricingName,
  568. pricingUnit: pricingUnitMap[val.pricingUnit],
  569. checked: false,
  570. amount: "",
  571. }
  572. })
  573. const result = this.adPricingModelList.map(model => {
  574. const matchedPrice = this.adSlotPriceList.find(price => price
  575. .adPricingModelId === model.adPricingModelId);
  576. return {
  577. ...model,
  578. amount: matchedPrice ? matchedPrice.amount : model.amount,
  579. checked: false,
  580. id: matchedPrice?.id,
  581. };
  582. }).filter(val => val.amount)
  583. this.adPricingModelList = result;
  584. })
  585. } else {
  586. uni.showToast({
  587. icon: "none",
  588. title: "该区域暂无计费模式相关配置"
  589. })
  590. }
  591. })
  592. },
  593. queryAdSlot() {
  594. this.$http.get('/adPosition/queryPageList').then(res => {
  595. if (res.data.code == 200) {
  596. if (res.data.code == 200) {
  597. this.adSlotList = res.data.result.records
  598. console.log(res.data.result);
  599. }
  600. }
  601. })
  602. },
  603. queryTree() {
  604. this.lodingShow = true;
  605. this.$http.post('/sys/area/queryTree').then(res => {
  606. if (res.data.code == 200) {
  607. console.log(res);
  608. this.queryTreeList = res.data.result
  609. this.lodingShow = false;
  610. }
  611. })
  612. },
  613. //省市区选择事件
  614. queryTreeConfirm(value) {
  615. this.queryTreeValue = `${value[0].label}-${value[1].label}-${value[2].label}-${value[3].label}`
  616. this.adForm.provinceCode = value[0].value;
  617. this.adForm.cityCode = value[1].value;
  618. this.adForm.districtCode = value[2].value;
  619. this.adForm.streetCode = value[3].value;
  620. this.adForm.province = value[0].label;
  621. this.adForm.city = value[1].label;
  622. this.adForm.district = value[2].label;
  623. this.adForm.street = value[3].label;
  624. this.getadBillingModel() //获取计费方式
  625. },
  626. //广告位选择后续操作
  627. adSlotConfirm(value) {
  628. let info = this.adSlotList.find(val => val.id == value[0].value).supportMaterial.split(','); //获取投放内容类型
  629. if (info.length > 1) {
  630. this.tabList = info.map(val => {
  631. return {
  632. label: val == 1 ? '图片' : '视频',
  633. value: val
  634. }
  635. })
  636. } else {
  637. this.tabList = [];
  638. }
  639. this.adForm.imageType = info[0];
  640. this.adForm.positionId = value[0].value;
  641. this.adForm.positionName = value[0].label;
  642. },
  643. //日期选择
  644. startDateChange(e) {
  645. this.adForm.startDate = e.result + " 00:00:00"
  646. },
  647. endDateChange(e) {
  648. this.adForm.endDate = e.result + " 23:59:59"
  649. },
  650. // 时间选择
  651. timeSegmentStartConfirm(value) {
  652. this.timeSegmentStart = `${value.hour}:${value.minute}:${value.second}`
  653. },
  654. timeSegmentEndConfirm(value) {
  655. this.timeSegmentEnd = `${value.hour}:${value.minute}:${value.second}`
  656. },
  657. userDailyImpCountChange(value) {
  658. if (value == 1) {
  659. this.adForm.userDailyDisplayLimit = ' ';
  660. } else {
  661. this.adForm.userDailyDisplayLimit = '';
  662. }
  663. },
  664. userImpCountChange(value) {
  665. if (value == 1) {
  666. this.adForm.userTotalDisplayLimit = ' ';
  667. } else {
  668. this.adForm.userTotalDisplayLimit = '';
  669. }
  670. },
  671. displayTimeIntervalChange(value) {
  672. if (value == 1) {
  673. this.adForm.showInterval = ' ';
  674. } else {
  675. this.adForm.showInterval = '';
  676. }
  677. },
  678. //周列表
  679. generateWeek() {
  680. const weekList = ['周一', '周二', '周三', '周四', '周五', '周六', '周日'].map((val, index) => {
  681. return {
  682. label: val,
  683. value: (index + 1).toString()
  684. }
  685. })
  686. this.weekList = weekList;
  687. },
  688. // 月列表
  689. generatemonth() {
  690. const monthList = Array.from({
  691. length: 31
  692. }, (_, index) => {
  693. const value = (index + 1).toString();
  694. return {
  695. label: value,
  696. value
  697. };
  698. });
  699. this.monthList = monthList;
  700. },
  701. // 周期策略选择
  702. toggleDaySelection(dayValue) {
  703. const index = this.selectedDays.indexOf(dayValue);
  704. if (index > -1) {
  705. // 如果找到,移除该元素
  706. this.selectedDays.splice(index, 1);
  707. } else {
  708. // 如果未找到,添加该元素
  709. this.selectedDays.push(dayValue);
  710. }
  711. this.adForm.validPeriodValue = this.selectedDays.join(',')
  712. },
  713. //生效周期选择
  714. validPeriodTypeSelect(item) {
  715. this.adForm.validPeriodType = item.value
  716. this.selectedDays = [];
  717. },
  718. timeSegmentSelect(item) {
  719. this.adForm.validTimeRangeType = item.value
  720. if (item.value == 0) {
  721. this.adForm.validTimeRangeValue = "00:00:00,23:59:59"
  722. } else {
  723. this.adForm.validTimeRangeValue = "";
  724. this.timeSegmentStart = "";
  725. this.timeSegmentEnd = "";
  726. }
  727. }
  728. }
  729. }
  730. </script>
  731. <style lang="scss" scoped>
  732. .page {
  733. background-color: #F7F8FC;
  734. }
  735. .module {
  736. width: 100%;
  737. background: #FFFFFF;
  738. border-radius: 10rpx;
  739. padding: 30rpx 30rpx 0;
  740. box-sizing: border-box;
  741. margin-bottom: 20rpx;
  742. display: flex;
  743. flex-direction: column;
  744. .module-title {
  745. font-size: 34rpx;
  746. color: #333;
  747. font-weight: bold;
  748. }
  749. .tab-view {
  750. background: #FFFFFF;
  751. border-radius: 10rpx;
  752. border: 1px solid #E5E5E5;
  753. font-size: 26rpx;
  754. color: #333;
  755. padding: 10rpx 32rpx;
  756. box-sizing: border-box;
  757. margin-left: 20rpx;
  758. text {
  759. line-height: 1;
  760. }
  761. }
  762. .tab-view-active {
  763. background: #E0EDFF;
  764. color: #006DFF;
  765. border: 1rpx solid #E0EDFF;
  766. }
  767. .extendArea {
  768. padding: 20rpx 20rpx;
  769. box-sizing: border-box;
  770. background: #F6F8FC;
  771. border-radius: 10rpx;
  772. }
  773. .cycleStrategy {
  774. min-width: 100rpx;
  775. background: #FFFFFF;
  776. border-radius: 10rpx;
  777. border: 1px solid #E5E5E5;
  778. font-size: 26rpx;
  779. color: #333;
  780. padding: 10rpx 32rpx;
  781. box-sizing: border-box;
  782. margin-left: 20rpx;
  783. margin-bottom: 20rpx;
  784. text {
  785. line-height: 1;
  786. }
  787. }
  788. .tcycleStrategy-active {
  789. background: #E0EDFF;
  790. color: #006DFF;
  791. border: 1rpx solid #E0EDFF;
  792. }
  793. //计费模式
  794. .BillingModelView {
  795. width: 100%;
  796. border-bottom: 1rpx solid #eee;
  797. padding: 32rpx 0;
  798. box-sizing: border-box;
  799. }
  800. .deliveryFrequency {
  801. padding: 32rpx 0;
  802. box-sizing: border-box;
  803. border-bottom: 1rpx solid #eee;
  804. .title {
  805. font-size: 26rpx;
  806. color: #333;
  807. width: 250rpx;
  808. }
  809. }
  810. .deliveryFrequency:last-child {
  811. border-bottom: none;
  812. }
  813. }
  814. ::v-deep {
  815. .u-radio__label {
  816. color: #333;
  817. }
  818. // 图片上传预览视图层级提升
  819. }
  820. .uni-system-preview-image {
  821. background: #4B9DFF !important;
  822. z-index: 9999 !important;
  823. }
  824. .footer-view {
  825. z-index: 99;
  826. position: fixed;
  827. bottom: 0;
  828. left: 0;
  829. right: 0;
  830. background-color: #fff;
  831. padding: 17rpx 24rpx;
  832. box-sizing: border-box;
  833. box-shadow: 0rpx 0rpx 12rpx 1rpx rgba(225, 225, 225, 0.3);
  834. >view {
  835. width: 100%;
  836. padding: 26rpx;
  837. box-sizing: border-box;
  838. background: #4B9DFF;
  839. border-radius: 40rpx;
  840. font-size: 30rpx;
  841. color: #fff;
  842. }
  843. }
  844. .fileUpload {
  845. position: relative;
  846. width: 100%;
  847. margin: 0 auto;
  848. box-sizing: border-box;
  849. border-radius: 0px 10rpx 10rpx 10rpx;
  850. margin: 30rpx 0;
  851. .tabs {
  852. display: flex;
  853. position: relative;
  854. overflow: hidden;
  855. border-radius: 10rpx 10rpx 0 0;
  856. }
  857. .tab {
  858. flex: 1;
  859. height: 70rpx;
  860. color: #333;
  861. font-size: 30rpx;
  862. position: relative;
  863. border-top-right-radius: 10rpx;
  864. border-top-left-radius: 10rpx;
  865. &.active {
  866. background: #F6F8FC;
  867. color: #006DFF;
  868. font-size: 30rpx;
  869. border-top-right-radius: 10rpx;
  870. border-top-left-radius: 10rpx;
  871. }
  872. &.left.active {
  873. border-top-right-radius: 0;
  874. &::after {
  875. content: "";
  876. position: absolute;
  877. top: 0;
  878. right: -50px;
  879. height: 100%;
  880. width: 50px;
  881. z-index: 2;
  882. background-color: #F6F8FC;
  883. clip-path: path("M0 0 C13.5 0 13.5 25 25 45 L0 50 Z");
  884. }
  885. }
  886. // 右侧标签的曲线
  887. &.right.active {
  888. border-top-left-radius: 0;
  889. &::before {
  890. content: "";
  891. position: absolute;
  892. top: 0;
  893. left: -49px;
  894. height: 100%;
  895. width: 50px;
  896. z-index: 2;
  897. background-color: #F6F8FC;
  898. clip-path: path("M50 0 C37.5 0 37.5 25 25 45 L50 50 Z");
  899. }
  900. }
  901. }
  902. .tab1 {
  903. flex: 1;
  904. height: 70rpx;
  905. position: relative;
  906. border-top-right-radius: 10rpx;
  907. border-top-left-radius: 10rpx;
  908. background-color: #EBF2FA;
  909. }
  910. // 文件区域样式
  911. .tabtitle {
  912. position: relative;
  913. z-index: 1; // 父级降低层级
  914. font-size: 28rpx;
  915. }
  916. }
  917. .fileUploadView {
  918. width: 100%;
  919. background-color: #F6F8FC;
  920. border-radius: 10rpx 10rpx 10rpx 10rpx;
  921. min-height: 330rpx;
  922. .default {
  923. min-height: 330rpx;
  924. padding: 30rpx 40rpx;
  925. box-sizing: border-box;
  926. image {
  927. width: 83rpx;
  928. height: 74rpx;
  929. }
  930. text {
  931. font-size: 26rpx;
  932. color: #333;
  933. }
  934. .title {
  935. margin: 15rpx 0 40rpx;
  936. }
  937. text:last-child {
  938. font-size: 22rpx;
  939. color: #aaa;
  940. }
  941. }
  942. }
  943. </style>