金诚优选前端代码
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.

152 lines
3.6 KiB

  1. <template>
  2. <view id="pointstore-record">
  3. <view class="contents">
  4. <view>
  5. <view class="no-list" v-if="reveal">
  6. 暂无数据
  7. </view>
  8. <view class="record-box" v-for="(item, idx) in recordList" :key="idx" >
  9. <view class="item mx-1px-bottom" :data-no="item.order_no" v-for="(item, index) in recordList[idx]" :key="index" @tap="jump">
  10. <view class="left">
  11. <view class="name">
  12. {{item.items[0].item_name}}
  13. </view>
  14. <view class="time">
  15. {{item.submit_time}}
  16. </view>
  17. </view>
  18. <view class="right">
  19. -{{item.redeem_point}}
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. /**
  29. * Created by lcfevr on 2018/4/16.
  30. */
  31. import {pageLogin, getUrl,config,is} from '@/common/js/utils.js';
  32. export default {
  33. data() {
  34. return {
  35. page: 1,
  36. recordList: [],
  37. meta: '',
  38. show: false,
  39. reveal: false
  40. };
  41. },
  42. onLoad() {
  43. this.recordListF(this.page);
  44. },
  45. components: {},
  46. props: {},
  47. methods: {
  48. jump(e) {
  49. console.log(e);
  50. wx.navigateTo({
  51. url: '/pages/pointStore/orderdetail/orderdetail?no=' + e.currentTarget.dataset.no
  52. });
  53. },
  54. recordListF(page = 1) {
  55. var token = this.$cookieStorage.get('user_token');
  56. var oauth = token;
  57. wx.showLoading({
  58. title: '加载中',
  59. mask: true
  60. });
  61. this.$http.get({
  62. api: 'api/order/point/list',
  63. header: {
  64. Authorization: oauth
  65. },
  66. data: {
  67. page: page
  68. }
  69. }).then(res => {
  70. if (res.statusCode == 200) {
  71. res = res.data;
  72. if (res.status) {
  73. // 商品列表页赋值
  74. this.setData({
  75. // [`recordList.${page - 1}`]: res.data,
  76. meta: res.meta
  77. });
  78. this.$set(this.recordList, page -1, res.data);
  79. if (res.data != '') {
  80. this.setData({
  81. reveal: false
  82. });
  83. } else {
  84. this.setData({
  85. reveal: true
  86. });
  87. }
  88. } else {
  89. wx.showModal({
  90. title: '',
  91. content: res.message,
  92. showCancel: false
  93. });
  94. }
  95. } else {
  96. wx.showModal({
  97. content: res.message || '请求失败',
  98. showCancel: false
  99. });
  100. }
  101. this.setData({
  102. show: false
  103. });
  104. wx.hideLoading();
  105. }).catch(rej => {
  106. wx.showModal({
  107. content: "请求失败",
  108. showCancel: false
  109. });
  110. this.setData({
  111. show: false
  112. });
  113. wx.hideLoading();
  114. });
  115. },
  116. setData: function (obj) {
  117. let that = this;
  118. let keys = [];
  119. let val, data;
  120. Object.keys(obj).forEach(function (key) {
  121. keys = key.split('.');
  122. val = obj[key];
  123. data = that.$data;
  124. keys.forEach(function (key2, index) {
  125. if (index + 1 == keys.length) {
  126. that.$set(data, key2, val);
  127. } else {
  128. if (!data[key2]) {
  129. that.$set(data, key2, {});
  130. }
  131. }
  132. data = data[key2];
  133. });
  134. });
  135. }
  136. },
  137. computed: {},
  138. watch: {}
  139. };
  140. </script>
  141. <style rel="stylesheet/less" lang="less">
  142. @import "record";
  143. </style>