帧视界壹通告,付费看视频的微信小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

357 lines
8.3 KiB

  1. <template>
  2. <view class="promotionDetail">
  3. <!--顶部导航栏-->
  4. <navbar leftClick @leftClick="$utils.navigateBack" title="推广详情" />
  5. <!--主页面-->
  6. <view class="frame">
  7. <!--标题-->
  8. <view class="title">
  9. <span>推广基本信息</span>
  10. </view>
  11. <!--基本信息-->
  12. <view style="" class="basicInfo">
  13. <!-- <view class="item">
  14. <view class="label">推广名称</view>
  15. <view class="value">
  16. <uv-input v-model="form.promotionName" placeholder="请输入推广名称" border="bottom" type='number'
  17. clearable></uv-input>
  18. </view>
  19. </view> -->
  20. <view class="item">
  21. <view class="label">推广作品</view>
  22. <view class="value">{{item.name}}</view>
  23. </view>
  24. <view class="item">
  25. <view class="label">价格</view>
  26. <view class="value">{{item.price }}</view>
  27. </view>
  28. <view class="item">
  29. <view class="label">时长</view>
  30. <view class="value">{{item.tuTime}}</view>
  31. </view>
  32. <view class="item">
  33. <view class="label">联系方式</view>
  34. <view class="value">
  35. <uv-input v-model="item.phone" placeholder="请输入联系方式" border="bottom" type='number'
  36. clearable></uv-input>
  37. </view>
  38. </view>
  39. <view class="item">
  40. <view class="label">剩余推广时长</view>
  41. <view class="value">{{item.remainingPromotionTime}}</view>
  42. </view>
  43. <!-- <view>推广作品</view>
  44. <view style="width: 30%;height: 300rpx;border-radius: 20rpx;overflow: hidden;">
  45. <image :src="item.image" style="width: 100%;height: 100%;"></image>
  46. </view> -->
  47. </view>
  48. <!-- ActionSheet 操作菜单 -->
  49. <uv-action-sheet ref="actionSheet" :actions="upTopList" title="选择推广时长" @select="select" @close="close"
  50. :closeOnClickAction="false">
  51. </uv-action-sheet>
  52. <!--确认发布弹框-->
  53. <uv-popup ref="popup" mode="center" custom-style="height: 400rpx;">
  54. <view class="content">
  55. <view class="title">
  56. 推广选项
  57. </view>
  58. <!--付费周期-->
  59. <view style="" class="payCycle">
  60. <view>付费周期</view>
  61. <view>{{item.day}}</view>
  62. </view>
  63. <!--金额-->
  64. <view style="width:100%;display: flex;justify-content: space-between;align-items: center;">
  65. <view>金额</view>
  66. <view>{{item.money}}</view>
  67. </view>
  68. <!--确认推广按钮-->
  69. <view class="confirmBottom">
  70. <button @click="confirmPromotion" class="confirmBtn">
  71. 确认推广
  72. </button>
  73. </view>
  74. </view>
  75. </uv-popup>
  76. <!--支付弹框-->
  77. <confirmationPopup ref="confirmationPopup" title="提示" @confirm="pay" confirmText="确认支付">
  78. <view class="confirmationPopup">
  79. <image src="/static/image/publish/pay.png" style="width: 150rpx;height: 150rpx;" mode=""></image>
  80. <view class="info">
  81. 确认支付{{ item.money }}可置顶{{ item.day }}
  82. </view>
  83. </view>
  84. </confirmationPopup>
  85. <!-- 平台审核弹框 -->
  86. <confirmationPopup ref="confirmationPopupUpload" title="提示" confirmText="确认" @confirm="confirm()">
  87. <view class="confirmationPopup">
  88. <image src="/static/image/publish/upload.png" style="width: 150rpx;height: 150rpx;" mode=""></image>
  89. <view class="info">
  90. 已由平台进行审核时间周期为24小时
  91. </view>
  92. </view>
  93. </confirmationPopup>
  94. </view>
  95. <!--继续推广按钮-->
  96. <button @click="continueToPromotion" class="bottomBtn">
  97. 继续推广
  98. </button>
  99. </view>
  100. </template>
  101. <script>
  102. import dayjs from 'dayjs';
  103. import '../../../../common.css'; // 引入公共 CSS 文件
  104. import confirmationPopup from '@/components/toast/confirmationPopup.vue'
  105. export default {
  106. onLoad(options) {
  107. // if (options.item) {
  108. // let item = JSON.parse(decodeURIComponent(options.item));
  109. // }
  110. this.item.id = options.id
  111. },
  112. components: {
  113. confirmationPopup
  114. },
  115. data() {
  116. return {
  117. upTopList: [],
  118. item: {
  119. day: 0,
  120. money: 0,
  121. },
  122. param: {
  123. type: 'default',
  124. title: '结束后跳转标签页',
  125. message: "推广成功",
  126. url: '/pages/componentsD/tag/tag'
  127. }
  128. };
  129. },
  130. mounted() {
  131. this.getData()
  132. this.indexTopPayList()
  133. },
  134. methods: {
  135. // 获取推广详情数据
  136. getData() {
  137. this.$api('infoGetPromotionDetail',{id: this.item.id}, res => {
  138. if (res.code == 200) {
  139. this.item = res.result
  140. // 计算推广时间加上置顶时间
  141. const futureTime = dayjs(this.item.createTime).add(this.item.tuTime, "day")
  142. // 获取当前时间
  143. const now = dayjs();
  144. // 计算两个时间之间的差异(毫秒)
  145. const diff = futureTime.diff(now);
  146. // 将毫秒转换为小时和天
  147. const hours = Math.floor(diff / 3600000);
  148. const days = Math.floor(hours / 24);
  149. // 根据时间差显示不同的格式
  150. if (days > 0) {
  151. // 超过24小时
  152. const remainingHours = hours % 24;
  153. console.log(`${days}${remainingHours}小时`);
  154. this.item.remainingPromotionTime = `${days}${remainingHours}小时`
  155. } else {
  156. // 没有超过24小时
  157. console.log(`${hours}小时`);
  158. this.item.remainingPromotionTime = `${hours}小时`
  159. }
  160. }
  161. })
  162. },
  163. // 获取置顶方式
  164. indexTopPayList() {
  165. this.$api('indexTopPayList', res => {
  166. if (res.code == 200) {
  167. for (var i = 0; i < res.result.length; i++) {
  168. this.upTopList.push({
  169. name: '置顶' + res.result[i].day + '天' + res.result[i].money + '元'
  170. })
  171. }
  172. }
  173. })
  174. },
  175. select(e) {
  176. console.log('选中该项:', e);
  177. // 使用正则表达式匹配所有的数字
  178. const matches = e.name.match(/\d+/g).map(Number);
  179. // 如果匹配到数字,则输出
  180. if (matches) {
  181. console.log(matches, "matches");
  182. this.item.day = matches[0]
  183. this.item.money = matches[1]
  184. }
  185. console.log(this.item.day, "this.item.day");
  186. this.$refs.actionSheet.close() //关闭弹框
  187. this.$refs.popup.open() //打开另外一个弹框
  188. },
  189. // ActionSheet 操作菜单关闭
  190. close() {
  191. this.$refs.actionSheet.close() //关闭弹框
  192. // this.$refs.popup.open() //打开另外一个弹框
  193. },
  194. // 提交平台审核的弹框的确认回调
  195. confirm(e) {
  196. uni.navigateTo({
  197. url: "/pages/index/index"
  198. })
  199. },
  200. // 继续推广按钮
  201. continueToPromotion() {
  202. if(this.item.phone=='' || this.item.phone==null){
  203. return uni.showToast({
  204. title: '请输入联系电话',
  205. icon : 'none'
  206. })
  207. }
  208. this.$refs.actionSheet.open();
  209. },
  210. // 确认发布弹框
  211. confirmPromotion() {
  212. this.$refs.confirmationPopup.open()
  213. this.$refs.popup.close()
  214. },
  215. pay() {
  216. this.$refs.confirmationPopupUpload.open()
  217. return
  218. // 支付逻辑待补充
  219. this.$api('ConfirmPromotion', {}, res => {
  220. if (res.code == 200) {
  221. //平台审核
  222. this.$refs.confirmationPopupUpload.open()
  223. }
  224. })
  225. },
  226. }
  227. }
  228. </script>
  229. <style lang="scss" scoped>
  230. * {
  231. box-sizing: border-box;
  232. margin: 0;
  233. padding: 0;
  234. }
  235. .promotionDetail {
  236. width: 100vw;
  237. height: 100vh;
  238. .frame {
  239. width: 100%;
  240. //height: calc(100vh - 220rpx);
  241. padding: 28rpx 28rpx 0 28rpx;
  242. .title {
  243. font-size: 36rpx;
  244. font-weight: 600;
  245. }
  246. .basicInfo {
  247. display: flex;
  248. flex-direction: column;
  249. gap: 60rpx;
  250. margin-top: 50rpx;
  251. width: 90%;
  252. .item {
  253. display: flex;
  254. justify-content: space-between;
  255. .label {
  256. width: 60%;
  257. }
  258. .value {
  259. width: 40%;
  260. }
  261. }
  262. }
  263. .bottom {
  264. position: fixed;
  265. bottom: 30rpx;
  266. left: 25%;
  267. width: 50%;
  268. height: 100rpx;
  269. .continueBtn {
  270. color: #ffffff;
  271. background: $uni-linear-gradient-btn-color;
  272. }
  273. }
  274. }
  275. .content {
  276. display: flex;
  277. flex-direction: column;
  278. justify-content: flex-start;
  279. gap: 20rpx;
  280. width: 600rpx;
  281. height: 100%;
  282. padding: 20rpx;
  283. .title {
  284. display: flex;
  285. justify-content: center;
  286. align-items: center;
  287. }
  288. .payCycle {
  289. width: 100%;
  290. display: flex;
  291. justify-content: space-between;
  292. align-items: center;
  293. }
  294. .confirmBtn {
  295. width: 50%;
  296. height: 80rpx;
  297. text-align: center;
  298. color: #ffffff;
  299. background: linear-gradient(to right, #3c69f1, #5f3bf5);
  300. display: flex;
  301. justify-content: center;
  302. align-items: center;
  303. font-size: 30rpx;
  304. margin-top: 50rpx;
  305. }
  306. }
  307. }
  308. /deep/ .uv-popup .uv-popup__content {
  309. border-radius: 20rpx;
  310. }
  311. </style>