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.
|
|
<template> <view class="flex-col group_4"> <view class="flex-col"> <image src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497759710376128.png" class="image_6" /> <view class="flex-col section_2"> <view class="flex-col items-center section_3"> <text class="text_2">{{userData.agent_code}}</text> <text class="text_3">有效期:{{unixTimeFormat(userData.start_time)}} 至 {{unixTimeFormat(userData.end_time)}}</text> </view> <text class="text_4">注:重新生成后没使用的优惠码将失效</text> <view class="flex-col group_6"> <view class="flex-col items-center button" @click="copy()"><text class="text_5">复制分销优惠码</text></view> <view class="flex-col items-center button_1" @click="refreshCode()"><text class="text_6">重新生成优惠码</text></view> </view> </view> </view> <view class="section_4"><!--*--></view> </view></template>
<script> import { couponSearch,couponUpdate } from '@/service/index.js'; import { dateFormat } from '@/common/dateFtt.js'; export default { data(){ return { userData:null } }, onLoad() { couponSearch({}).then((res)=>{ this.userData = res.data.datas console.log("couponSearch",res); }) }, methods: { unixTimeFormat(t){ return dateFormat(new Date(t*1000),'yyyy-MM-dd') }, copy(){ let userInfo = uni.getStorageSync('userInfo'); console.log(11111); uni.setClipboardData({ data:this.userData.agent_code, showToast:true, success() { uni.showToast({ title:"已复制优惠码" }) } }) }, refreshCode(){ couponUpdate({}).then((res)=>{ this.userData = res.data.datas console.log("couponUpdate",res); }) }, } }</script>
<style> .group_4 { padding-bottom: 0.5rem; flex: 1 1 auto; overflow-y: auto; } .section_4 { margin-top: 22.63rem; align-self: center; background-color: #000000; border-radius: 0.13rem; width: 6.13rem; height: 0.25rem; } .image_6 { width: 100vw; height: 0.8vw; } .section_2 { padding: 1.25rem 1rem; background-color: #ffffff; } .section_3 { padding: 1.25rem 0; background-color: #f6f6f6; border-radius: 0.31rem; } .text_4 { margin-top: 0.94rem; align-self: center; color: #999999; font-size: 0.88rem; font-family: 'PingFangSC-Medium'; font-weight: 500; line-height: 1.25rem; } .group_6 { margin-top: 3.75rem; } .text_2 { color: #e7a23f; font-size: 1.5rem; font-family: 'PingFangSC-Semibold'; font-weight: 600; line-height: 2.06rem; } .text_3 { margin-top: 0.63rem; color: #777777; font-size: 0.88rem; font-family: 'PingFangSC-Medium'; font-weight: 500; line-height: 1.25rem; } .button { padding: 0.81rem 0; background-color: #e7a23f; border-radius: 0.31rem; } .button_1 { margin-top: 0.88rem; padding: 0.75rem 0; border-radius: 0.31rem; border: solid 0.063rem #e7a23f; } .text_5 { color: #ffffff; font-size: 1rem; font-family: 'PingFangSC-Semibold'; font-weight: 600; line-height: 1.38rem; } .text_6 { color: #e7a23f; font-size: 1rem; font-family: 'PingFangSC-Semibold'; font-weight: 600; line-height: 1.38rem; }</style>
|