球星卡微信小程序
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.

146 lines
3.3 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. <template>
  2. <view class="flex-col group_4">
  3. <view class="flex-col">
  4. <image
  5. src="https://codefun-proj-user-res-1256085488.cos.ap-guangzhou.myqcloud.com/62677e395a7e3f03107ffc5f/62677e4a35a7e10011e93a80/16509497759710376128.png"
  6. class="image_6"
  7. />
  8. <view class="flex-col section_2">
  9. <view class="flex-col items-center section_3">
  10. <text class="text_2">{{userData.agent_code}}</text>
  11. <text class="text_3">有效期{{unixTimeFormat(userData.start_time)}} {{unixTimeFormat(userData.end_time)}}</text>
  12. </view>
  13. <text class="text_4">重新生成后没使用的优惠码将失效</text>
  14. <view class="flex-col group_6">
  15. <view class="flex-col items-center button" @click="copy()"><text class="text_5">复制分销优惠码</text></view>
  16. <view class="flex-col items-center button_1" @click="refreshCode()"><text class="text_6">重新生成优惠码</text></view>
  17. </view>
  18. </view>
  19. </view>
  20. <view class="section_4"><!--*--></view>
  21. </view>
  22. </template>
  23. <script>
  24. import { couponSearch,couponUpdate } from '@/service/index.js';
  25. import { dateFormat } from '@/common/dateFtt.js';
  26. export default {
  27. data(){
  28. return {
  29. userData:null
  30. }
  31. },
  32. onLoad() {
  33. couponSearch({}).then((res)=>{
  34. this.userData = res.data.datas
  35. console.log("couponSearch",res);
  36. })
  37. },
  38. methods: {
  39. unixTimeFormat(t){
  40. return dateFormat(new Date(t*1000),'yyyy-MM-dd')
  41. },
  42. copy(){
  43. let userInfo = uni.getStorageSync('userInfo');
  44. console.log(11111);
  45. uni.setClipboardData({
  46. data:this.userData.agent_code,
  47. showToast:true,
  48. success() {
  49. uni.showToast({
  50. title:"已复制优惠码"
  51. })
  52. }
  53. })
  54. },
  55. refreshCode(){
  56. couponUpdate({}).then((res)=>{
  57. this.userData = res.data.datas
  58. console.log("couponUpdate",res);
  59. })
  60. },
  61. }
  62. }
  63. </script>
  64. <style>
  65. .group_4 {
  66. padding-bottom: 0.5rem;
  67. flex: 1 1 auto;
  68. overflow-y: auto;
  69. }
  70. .section_4 {
  71. margin-top: 22.63rem;
  72. align-self: center;
  73. background-color: #000000;
  74. border-radius: 0.13rem;
  75. width: 6.13rem;
  76. height: 0.25rem;
  77. }
  78. .image_6 {
  79. width: 100vw;
  80. height: 0.8vw;
  81. }
  82. .section_2 {
  83. padding: 1.25rem 1rem;
  84. background-color: #ffffff;
  85. }
  86. .section_3 {
  87. padding: 1.25rem 0;
  88. background-color: #f6f6f6;
  89. border-radius: 0.31rem;
  90. }
  91. .text_4 {
  92. margin-top: 0.94rem;
  93. align-self: center;
  94. color: #999999;
  95. font-size: 0.88rem;
  96. font-family: 'PingFangSC-Medium';
  97. font-weight: 500;
  98. line-height: 1.25rem;
  99. }
  100. .group_6 {
  101. margin-top: 3.75rem;
  102. }
  103. .text_2 {
  104. color: #e7a23f;
  105. font-size: 1.5rem;
  106. font-family: 'PingFangSC-Semibold';
  107. font-weight: 600;
  108. line-height: 2.06rem;
  109. }
  110. .text_3 {
  111. margin-top: 0.63rem;
  112. color: #777777;
  113. font-size: 0.88rem;
  114. font-family: 'PingFangSC-Medium';
  115. font-weight: 500;
  116. line-height: 1.25rem;
  117. }
  118. .button {
  119. padding: 0.81rem 0;
  120. background-color: #e7a23f;
  121. border-radius: 0.31rem;
  122. }
  123. .button_1 {
  124. margin-top: 0.88rem;
  125. padding: 0.75rem 0;
  126. border-radius: 0.31rem;
  127. border: solid 0.063rem #e7a23f;
  128. }
  129. .text_5 {
  130. color: #ffffff;
  131. font-size: 1rem;
  132. font-family: 'PingFangSC-Semibold';
  133. font-weight: 600;
  134. line-height: 1.38rem;
  135. }
  136. .text_6 {
  137. color: #e7a23f;
  138. font-size: 1rem;
  139. font-family: 'PingFangSC-Semibold';
  140. font-weight: 600;
  141. line-height: 1.38rem;
  142. }
  143. </style>