|
|
- <template>
- <view class="promotionDetail">
- <!--顶部导航栏-->
- <navbar leftClick @leftClick="$utils.navigateBack" title="推广详情" />
-
- <!--主页面-->
- <view class="frame">
- <!--标题-->
- <view class="title">
- <span>推广基本信息</span>
- </view>
-
- <!--基本信息-->
- <view style="" class="basicInfo">
- <!-- <view class="item">
- <view class="label">推广名称</view>
- <view class="value">
- <uv-input v-model="form.promotionName" placeholder="请输入推广名称" border="bottom" type='number'
- clearable></uv-input>
- </view>
- </view> -->
- <view class="item">
- <view class="label">价格</view>
- <view class="value">{{item.goTiime}}</view>
- </view>
- <view class="item">
- <view class="label">时长</view>
- <view class="value">{{item.price}}</view>
- </view>
- <view class="item">
- <view class="label">联系方式</view>
- <view class="value">
- <uv-input v-model="item.phone" placeholder="请输入联系方式" border="bottom" type='number'
- clearable></uv-input>
- </view>
- </view>
- <view class="item">
- <view class="label">剩余推广时长</view>
- <view class="value">{{item.remainingPromotionTime}}</view>
- </view>
- <view>推广作品</view>
- <view style="width: 30%;height: 300rpx;border-radius: 20rpx;overflow: hidden;">
- <image :src="item.image" style="width: 100%;height: 100%;"></image>
- </view>
- </view>
-
-
-
-
- <!-- ActionSheet 操作菜单 -->
- <uv-action-sheet ref="actionSheet" :actions="upTopList" title="选择推广时长" @select="select" @close="close"
- :closeOnClickAction="false">
- </uv-action-sheet>
-
- <!--确认发布弹框-->
- <uv-popup ref="popup" mode="center" custom-style="height: 400rpx;">
- <view class="content">
- <view class="title">
- 推广选项
- </view>
- <!--付费周期-->
- <view style="" class="payCycle">
- <view>付费周期</view>
- <view>{{item.day}}天</view>
- </view>
-
- <!--金额-->
- <view style="width:100%;display: flex;justify-content: space-between;align-items: center;">
- <view>金额</view>
- <view>¥{{item.money}}</view>
- </view>
-
- <!--确认推广按钮-->
- <view class="confirmBottom">
- <button @click="confirmPromotion" class="confirmBtn">
- 确认推广
- </button>
- </view>
- </view>
- </uv-popup>
-
- <!--支付弹框-->
- <confirmationPopup ref="confirmationPopup" title="提示" @confirm="pay" confirmText="确认支付">
- <view class="confirmationPopup">
- <image src="/static/image/publish/pay.png" style="width: 150rpx;height: 150rpx;" mode=""></image>
- <view class="info">
- 确认支付{{ item.money }}元,可置顶{{ item.day }}天
- </view>
- </view>
- </confirmationPopup>
-
- <!-- 平台审核弹框 -->
- <confirmationPopup ref="confirmationPopupUpload" title="提示" confirmText="确认" @confirm="confirm()">
- <view class="confirmationPopup">
- <image src="/static/image/publish/upload.png" style="width: 150rpx;height: 150rpx;" mode=""></image>
- <view class="info">
- 已由平台进行审核,时间周期为24小时
- </view>
- </view>
- </confirmationPopup>
- </view>
-
- <!--继续推广按钮-->
- <button @click="continueToPromotion" class="bottomBtn">
- 继续推广
- </button>
- </view>
- </template>
-
- <script>
- import dayjs from 'dayjs';
- import '../../../../common.css'; // 引入公共 CSS 文件
- import confirmationPopup from '@/components/toast/confirmationPopup.vue'
- export default {
- onLoad(options) {
- // if (options.item) {
- // let item = JSON.parse(decodeURIComponent(options.item));
- // }
- this.item.id = options.item.id
- },
- components: {
- confirmationPopup
- },
- data() {
- return {
- upTopList: [],
- item: {
- day: 0,
- money: 0,
- },
- param: {
- type: 'default',
- title: '结束后跳转标签页',
- message: "推广成功",
- url: '/pages/componentsD/tag/tag'
- }
- };
- },
- mounted() {
- // this.getData()
- this.indexTopPayList()
- },
- methods: {
- // 获取推广详情数据
- getData() {
- this.$api('infoGetPromotionDetail', item.id, res => {
- if (res.code == 200) {
- this.item = res.result.records
-
- // 计算推广时间加上置顶时间
- const futureTime = dayjs(this.item.createTime).add(this.item.goTiime, "day")
-
- // 获取当前时间
- const now = dayjs();
-
- // 计算两个时间之间的差异(毫秒)
- const diff = futureTime.diff(now);
-
- // 将毫秒转换为小时和天
- const hours = Math.floor(diff / 3600000);
- const days = Math.floor(hours / 24);
-
- // 根据时间差显示不同的格式
- if (days > 0) {
- // 超过24小时
- const remainingHours = hours % 24;
- console.log(`${days}天${remainingHours}小时`);
- this.item.remainingPromotionTime = `${days}天${remainingHours}小时`
- } else {
- // 没有超过24小时
- console.log(`${hours}小时`);
- this.item.remainingPromotionTime = `${hours}小时`
- }
- }
- })
- },
-
- // 获取置顶方式
- indexTopPayList() {
- this.$api('indexTopPayList', res => {
- if (res.code == 200) {
- for (var i = 0; i < res.result.length; i++) {
- this.upTopList.push({
- name: '置顶' + res.result[i].day + '天' + res.result[i].money + '元'
- })
- }
- }
- })
- },
-
- select(e) {
- console.log('选中该项:', e);
- // 使用正则表达式匹配所有的数字
- const matches = e.name.match(/\d+/g).map(Number);
-
- // 如果匹配到数字,则输出
- if (matches) {
- console.log(matches, "matches");
- this.item.day = matches[0]
- this.item.money = matches[1]
- }
- console.log(this.item.day, "this.item.day");
- this.$refs.actionSheet.close() //关闭弹框
- this.$refs.popup.open() //打开另外一个弹框
- },
-
- // ActionSheet 操作菜单关闭
- close() {
- this.$refs.actionSheet.close() //关闭弹框
- // this.$refs.popup.open() //打开另外一个弹框
- },
-
- // 提交平台审核的弹框的确认回调
- confirm(e) {
- uni.navigateTo({
- url: "/pages/index/index"
- })
- },
- // 继续推广按钮
- continueToPromotion() {
- if(this.item.phone=='' || this.item.phone==null){
- return uni.showToast({
- title: '请输入联系电话',
- icon : 'none'
- })
- }
- this.$refs.actionSheet.open();
- },
-
- // 确认发布弹框
- confirmPromotion() {
- this.$refs.confirmationPopup.open()
- this.$refs.popup.close()
- },
- pay() {
- this.$refs.confirmationPopupUpload.open()
- return
- // 支付逻辑待补充
- this.$api('ConfirmPromotion', {}, res => {
- if (res.code == 200) {
- //平台审核
- this.$refs.confirmationPopupUpload.open()
- }
- })
- },
- }
- }
- </script>
-
- <style lang="scss" scoped>
- * {
- box-sizing: border-box;
- margin: 0;
- padding: 0;
- }
-
- .promotionDetail {
- width: 100vw;
- height: 100vh;
-
- .frame {
- width: 100%;
- //height: calc(100vh - 220rpx);
- padding: 28rpx 28rpx 0 28rpx;
-
- .title {
- font-size: 36rpx;
- font-weight: 600;
- }
-
- .basicInfo {
- display: flex;
- flex-direction: column;
- gap: 60rpx;
- margin-top: 50rpx;
- width: 90%;
-
- .item {
- display: flex;
- justify-content: space-between;
-
- .label {
- width: 60%;
- }
-
- .value {
- width: 40%;
- }
- }
- }
-
- .bottom {
- position: fixed;
- bottom: 30rpx;
- left: 25%;
- width: 50%;
- height: 100rpx;
-
- .continueBtn {
- color: #ffffff;
- background: $uni-linear-gradient-btn-color;
- }
- }
- }
-
-
- .content {
- display: flex;
- flex-direction: column;
- justify-content: flex-start;
- gap: 20rpx;
- width: 600rpx;
- height: 100%;
- padding: 20rpx;
-
-
- .title {
- display: flex;
- justify-content: center;
- align-items: center;
- }
-
- .payCycle {
- width: 100%;
- display: flex;
- justify-content: space-between;
- align-items: center;
- }
-
- .confirmBtn {
- width: 50%;
- height: 80rpx;
- text-align: center;
- color: #ffffff;
- background: linear-gradient(to right, #3c69f1, #5f3bf5);
- display: flex;
- justify-content: center;
- align-items: center;
- font-size: 30rpx;
- margin-top: 50rpx;
- }
-
-
- }
-
-
- }
-
- /deep/ .uv-popup .uv-popup__content {
- border-radius: 20rpx;
- }
- </style>
|