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

145 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>
  21. </template>
  22. <script>
  23. import { couponSearch,couponUpdate } from '@/service/index.js';
  24. import { dateFormat } from '@/common/dateFtt.js';
  25. export default {
  26. data(){
  27. return {
  28. userData:null
  29. }
  30. },
  31. onLoad() {
  32. couponSearch({}).then((res)=>{
  33. this.userData = res.data.datas
  34. console.log("couponSearch",res);
  35. })
  36. },
  37. methods: {
  38. unixTimeFormat(t){
  39. return dateFormat(new Date(t*1000),'yyyy-MM-dd')
  40. },
  41. copy(){
  42. let userInfo = uni.getStorageSync('userInfo');
  43. console.log(11111);
  44. uni.setClipboardData({
  45. data:this.userData.agent_code,
  46. showToast:true,
  47. success() {
  48. uni.showToast({
  49. title:"已复制优惠码"
  50. })
  51. }
  52. })
  53. },
  54. refreshCode(){
  55. couponUpdate({}).then((res)=>{
  56. this.userData = res.data.datas
  57. console.log("couponUpdate",res);
  58. })
  59. },
  60. }
  61. }
  62. </script>
  63. <style>
  64. .group_4 {
  65. padding-bottom: 0.5rem;
  66. flex: 1 1 auto;
  67. overflow-y: auto;
  68. }
  69. .section_4 {
  70. margin-top: 22.63rem;
  71. align-self: center;
  72. background-color: #000000;
  73. border-radius: 0.13rem;
  74. width: 6.13rem;
  75. height: 0.25rem;
  76. }
  77. .image_6 {
  78. width: 100vw;
  79. height: 0.8vw;
  80. }
  81. .section_2 {
  82. padding: 1.25rem 1rem;
  83. background-color: #ffffff;
  84. }
  85. .section_3 {
  86. padding: 1.25rem 0;
  87. background-color: #f6f6f6;
  88. border-radius: 0.31rem;
  89. }
  90. .text_4 {
  91. margin-top: 0.94rem;
  92. align-self: center;
  93. color: #999999;
  94. font-size: 0.88rem;
  95. font-family: 'PingFangSC-Medium';
  96. font-weight: 500;
  97. line-height: 1.25rem;
  98. }
  99. .group_6 {
  100. margin-top: 3.75rem;
  101. }
  102. .text_2 {
  103. color: #e7a23f;
  104. font-size: 1.5rem;
  105. font-family: 'PingFangSC-Semibold';
  106. font-weight: 600;
  107. line-height: 2.06rem;
  108. }
  109. .text_3 {
  110. margin-top: 0.63rem;
  111. color: #777777;
  112. font-size: 0.88rem;
  113. font-family: 'PingFangSC-Medium';
  114. font-weight: 500;
  115. line-height: 1.25rem;
  116. }
  117. .button {
  118. padding: 0.81rem 0;
  119. background-color: #e7a23f;
  120. border-radius: 0.31rem;
  121. }
  122. .button_1 {
  123. margin-top: 0.88rem;
  124. padding: 0.75rem 0;
  125. border-radius: 0.31rem;
  126. border: solid 0.063rem #e7a23f;
  127. }
  128. .text_5 {
  129. color: #ffffff;
  130. font-size: 1rem;
  131. font-family: 'PingFangSC-Semibold';
  132. font-weight: 600;
  133. line-height: 1.38rem;
  134. }
  135. .text_6 {
  136. color: #e7a23f;
  137. font-size: 1rem;
  138. font-family: 'PingFangSC-Semibold';
  139. font-weight: 600;
  140. line-height: 1.38rem;
  141. }
  142. </style>