帧视界壹通告,付费看视频的微信小程序
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.

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