promoCode.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <!-- <template>
  2. <view class="warp">
  3. <view class="font">
  4. <uni-list class="font">
  5. <uni-list-item title="购买优惠码" @click="buy()" />
  6. </uni-list>
  7. </view>
  8. <view class="box">
  9. <view class="font">优惠码列表</view>
  10. <view class="header">
  11. <view class="nickname">
  12. 筛选条件:
  13. </view>
  14. <view class="nickname">
  15. 状态:
  16. </view>
  17. <view style="width: 20%; margin-bottom: 2px;padding-top: 2upx; ">
  18. <xfl-select :list="list" :clearable="false" :showItemNum="4" :focusShowList="true" :isCanInput="false"
  19. :style_Container="'height: 18px;font-size: 13px;'" :placeholder="''" :initValue="'全部'" :selectHideType="'hideAll'"
  20. @change="change">
  21. </xfl-select>
  22. </view>
  23. </view>
  24. <t-table @change="change">
  25. <t-tr>
  26. <t-th>优惠码</t-th>
  27. <t-th>到期时间</t-th>
  28. <t-th>状态</t-th>
  29. <t-th>使用时间</t-th>
  30. <t-th>使用机器</t-th>
  31. </t-tr>
  32. <t-tr v-for="item in tableList" :key="item.id">
  33. <t-td>{{ item.code}}</t-td>
  34. <t-td>{{ item.lastUseDate}}</t-td>
  35. <t-td>{{ item.isUse=='0'?'未使用':item.isUse=='1'?'已使用':item.isUse=='2'?'已过期':''}}</t-td>
  36. <t-td>{{ item.useDate}}</t-td>
  37. <t-td>{{ item.useBy}}</t-td>
  38. </t-tr>
  39. </t-table>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import tTable from '@/components/t-table/t-table.vue';
  45. import tTh from '@/components/t-table/t-th.vue';
  46. import tTr from '@/components/t-table/t-tr.vue';
  47. import tTd from '@/components/t-table/t-td.vue';
  48. import xflSelect from '@/components/xfl-select/xfl-select.vue';
  49. import uniList from '@/components/uni-list/uni-list.vue';
  50. import uniListItem from '@/components/uni-list-item/uni-list-item.vue';
  51. export default {
  52. components: {
  53. uniList,
  54. uniListItem,
  55. tTable,
  56. tTh,
  57. tTr,
  58. tTd,
  59. xflSelect
  60. },
  61. data() {
  62. return {
  63. tableList: [],
  64. list: [ //要展示的数据
  65. '全部',
  66. '未使用',
  67. '使用',
  68. '已过期',
  69. ],
  70. };
  71. },
  72. onShow() {
  73. var token = uni.getStorageSync("token");
  74. if (token.length>1) {
  75. this.init();
  76. }else{
  77. uni.reLaunch({
  78. url: '../Login/Login',
  79. });
  80. }
  81. },
  82. methods: {
  83. buy() {
  84. uni.navigateTo({
  85. url: 'buyPromo',
  86. });
  87. },
  88. init() {
  89. var globalUser = uni.getStorageSync("globalUser");
  90. var id = globalUser.id;
  91. var token = uni.getStorageSync("token");
  92. uni.request({
  93. url: this.serverurl + '/TPromoCode/findList',
  94. data: {
  95. "adminId": id,
  96. },
  97. header:{
  98. 'token':token
  99. },
  100. method: "POST",
  101. success: (res) => {
  102. this.tableList = res.data.data;
  103. }
  104. })
  105. },
  106. change({
  107. newVal,
  108. oldVal,
  109. index,
  110. orignItem
  111. }) {
  112. this.tableList=null;
  113. if(index==0){
  114. var isUse = null;
  115. }
  116. if(index==1){
  117. var isUse = 0;
  118. }
  119. if(index==2){
  120. var isUse = 1;
  121. }
  122. if(index==3){
  123. var isUse = 2;
  124. }
  125. var globalUser = uni.getStorageSync("globalUser");
  126. var id = globalUser.id;
  127. var token = uni.getStorageSync("token");
  128. uni.request({
  129. url: this.serverurl + '/TPromoCode/findList',
  130. data: {
  131. "adminId": id,
  132. "isUse":isUse
  133. },
  134. method: "POST",
  135. header:{
  136. 'token':token
  137. },
  138. success: (res) => {
  139. this.tableList = res.data.data;
  140. }
  141. })
  142. }
  143. }
  144. };
  145. </script>
  146. <style>
  147. .header {
  148. display: flex;
  149. flex-direction: row;
  150. justify-content: flex-start;
  151. padding-left: 10upx;
  152. }
  153. .nickname {
  154. padding-left: 10upx;
  155. height: 32upx;
  156. color: #363D44;
  157. font-size: 32upx;
  158. font-family: "PingFang-SC-Bold";
  159. }
  160. .font{
  161. color: #363D44;
  162. font-size: 36upx;
  163. font-family: "PingFang-SC-Bold";
  164. }
  165. </style>
  166. -->