createRecords.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="container">
  3. <view class="header">
  4. <image src="../../static/images/skm_fn_bg.png" mode="aspectFill" class="bg-img"></image>
  5. <view class="info">
  6. <text class="num" v-if="list.length>0">{{list[0].total||0}}</text>
  7. <text class="num" v-else>0</text>
  8. <text class="desc">条记录</text>
  9. </view>
  10. </view>
  11. <view class="main">
  12. <view class="page-title flex-row-between">
  13. <view class="title">生成记录</view>
  14. </view>
  15. <view v-for="(item,index) in list" :key="index" class="item-content" @click="viewRecords" :data-index='index'>
  16. <uni-swipe-action >
  17. <!-- 基础用法 -->
  18. <uni-swipe-action-item :disabled="item.type == 1?false:true" :right-options="options" @click="onClick($event,item.id,index)">
  19. <view class="item flex-row">
  20. <image src="../../static/images/icon_6.png" mode="aspectFit" class="type-img" v-if="item.type == 4"></image>
  21. <image src="../../static/images/icon_5.png" mode="aspectFit" class="type-img" v-if="item.type == 3"></image>
  22. <image src="../../static/images/icon_2.png" mode="aspectFit" class="type-img" v-if="item.type == 2"></image>
  23. <image src="../../static/images/icon_4.png" mode="aspectFit" class="type-img" v-if="item.type == 1"></image>
  24. <image src="../../static/images/icon_7.png" mode="aspectFit" class="type-img" v-if="item.type == 6"></image>
  25. <image src="../../static/images/icon_game.png" mode="aspectFit" class="type-img" v-if="item.type ==7"></image>
  26. <view class="info">
  27. <view class="title text-1" v-if="item.mid_title">{{item.mid_title}}</view>
  28. <view class="title text-1" v-if="item.description">{{item.description}}</view>
  29. <view class="desc flex-row-between">
  30. <view class="num">成功{{$test.$test}}次数:{{item.scan_num}}</view>
  31. <view class="time">{{item.create_time}}</view>
  32. </view>
  33. </view>
  34. </view>
  35. </uni-swipe-action-item>
  36. </uni-swipe-action>
  37. </view>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. export default {
  43. data() {
  44. return {
  45. $test: this.$test.$test,
  46. list: [],
  47. total: 0,
  48. page: 1,
  49. options: [
  50. {
  51. text: '删除',
  52. style: {
  53. backgroundColor: '#dd524d'
  54. }
  55. }
  56. ],
  57. }
  58. },
  59. onLoad() {
  60. this.page = 1;
  61. this.list = [];
  62. this.funeng_list();
  63. },
  64. onShow() {
  65. },
  66. onReachBottom(e) {
  67. this.funeng_list()
  68. },
  69. methods: {
  70. onClick(e, id, index) {
  71. if (e.content.text == "删除") {
  72. this.del(id, index);
  73. }
  74. },
  75. del(id, index) {
  76. uni.showModal({
  77. title: '提示',
  78. content: '是否要删除?',
  79. showCancel: true,
  80. cancelText: '取消',
  81. confirmText: '确定',
  82. success: res => {
  83. if (res.confirm) {
  84. this.request({
  85. url: 'funeng/funeng_del',
  86. data: {
  87. token: uni.getStorageSync("token"),
  88. id: id,
  89. },
  90. }).then(res => {
  91. console.log(res, "res")
  92. if (res.code === 200 || res.code === "200") {
  93. this.page = 1;
  94. this.list = [];
  95. this.funeng_list();
  96. }
  97. }).catch(() => {
  98. uni.showToast({
  99. title: res.message,
  100. icon: "none",
  101. })
  102. });
  103. }
  104. },
  105. fail: () => {},
  106. complete: () => {}
  107. });
  108. },
  109. viewRecords(e) {
  110. var index = e.currentTarget.dataset.index,
  111. card_num = this.list[index].card_num,
  112. type = this.list[index].type;
  113. uni.navigateTo({
  114. url: "../viewRecords/viewRecords?card_num=" + card_num + '&type=' + type
  115. })
  116. },
  117. funeng_list() {
  118. this.request({
  119. url: "user/funeng_list",
  120. data: {
  121. page: this.page,
  122. token: uni.getStorageSync("token"),
  123. },
  124. }).then(res => {
  125. console.log(res, "res")
  126. if (res.code === '200') {
  127. this.list = this.list.concat(res.data);
  128. this.page = this.page + 1;
  129. }
  130. });
  131. }
  132. }
  133. }
  134. </script>
  135. <style>
  136. .header {
  137. width: 100%;
  138. height: 198rpx;
  139. position: relative;
  140. }
  141. .header .bg-img {
  142. display: block;
  143. position: absolute;
  144. left: 0;
  145. top: 0;
  146. z-index: 1;
  147. width: 100%;
  148. height: 198rpx;
  149. }
  150. .header .info {
  151. width: 100%;
  152. height: 100%;
  153. display: flex;
  154. flex-flow: row nowrap;
  155. justify-content: center;
  156. align-items: center;
  157. z-index: 2;
  158. position: relative;
  159. }
  160. .header .info .num {
  161. font-size: 70rpx;
  162. font-weight: 700;
  163. font-family: DIN Alternate, DIN Alternate-Bold;
  164. color: #fff;
  165. line-height: 1;
  166. /* transform: scale(1, 1.3); */
  167. }
  168. .header .info .desc {
  169. font-size: 32rpx;
  170. line-height: 1;
  171. color: #fff;
  172. margin-top: 39rpx;
  173. }
  174. .main {
  175. background-color: #fff;
  176. border-radius: 20rpx 20rpx 0 0;
  177. margin-top: -20rpx;
  178. padding: 20rpx 40rpx 0;
  179. z-index: 3;
  180. position: relative;
  181. }
  182. .main .page-title {
  183. padding: 28rpx 0 40rpx;
  184. }
  185. .main .page-title .title {
  186. font-size: 36rpx;
  187. color: #262626;
  188. line-height: 50rpx;
  189. font-weight: 600;
  190. }
  191. .main .item {
  192. background-color: #fafafa;
  193. border-radius: 8rpx;
  194. padding: 40rpx 32rpx 40rpx 34rpx;
  195. width: 100%;
  196. }
  197. .main .item-content {
  198. margin-bottom: 40rpx;
  199. }
  200. .main .item .type-img {
  201. display: block;
  202. flex: none;
  203. width: 40rpx;
  204. height: 40rpx;
  205. margin-right: 26rpx;
  206. }
  207. .main .item .info {
  208. flex: auto;
  209. }
  210. .main .item .info .title {
  211. width: 538rpx;
  212. font-size: 30rpx;
  213. font-weight: 500;
  214. color: #323232;
  215. line-height: 42rpx;
  216. margin-bottom: 16rpx;
  217. }
  218. .main .item .info .desc {
  219. /* margin-top: 16rpx; */
  220. }
  221. .main .item .info .num {
  222. font-size: 28rpx;
  223. font-weight: 400;
  224. color: #3387FF;
  225. line-height: 40rpx;
  226. }
  227. .main .item .info .time {
  228. font-size: 28rpx;
  229. font-weight: 400;
  230. color: #999;
  231. line-height: 40rpx;
  232. }
  233. </style>