index.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <view>
  3. <u-cell-group>
  4. <!-- <u-cell icon="rmb-circle" title="积分余额" value="">
  5. <u--text slot="right-icon" :text="acTitle" color="rgb(55,186,189)"></u--text>
  6. <u--text slot="right-icon" :text="amassScore" color="rgb(55,186,189)"></u--text>
  7. </u-cell> -->
  8. <!-- <u-cell icon="calendar" title="积分订单" @click="toExpenseCalendarPage" :isLink="true"></u-cell> -->
  9. <u-cell icon="scan" title="积分卡激活" :isLink="true" @click="takeMeal"></u-cell>
  10. <!-- <u-cell icon="tags" title="积分卡发放" :isLink="true" @click="grantMeal"></u-cell> -->
  11. <u-cell icon="map" title="收件地址" :isLink="true" @click="toAddressMgtPage"></u-cell>
  12. <u-cell icon="clock" title="积分历史" :isLink="true" @click="toAmassScoreRecordPage"></u-cell>
  13. </u-cell-group>
  14. </view>
  15. </template>
  16. <script>
  17. export default {
  18. data() {
  19. return {
  20. acTitle: '',
  21. amassScore: 0
  22. }
  23. },
  24. onLoad() {
  25. this.acTitle = uni.getStorageSync('orgInfo').organizationName.substring(0, 1) + ":"
  26. this.getDataAmassScore()
  27. },
  28. methods: {
  29. toExpenseCalendarPage() {
  30. uni.navigateTo({
  31. url: "expense/expenseCalendar"
  32. })
  33. },
  34. toAmassScoreRecordPage() {
  35. this.$goto('amassScoreRecord')
  36. },
  37. takeMeal() {
  38. var that = this;
  39. uni.scanCode({
  40. scanType: ['qrCode'],
  41. success: function(res) {
  42. // uni.showModal({
  43. // content: JSON.stringify(res),
  44. // })
  45. if (res.result) {
  46. uni.setStorageSync("rfiCard", res.result)
  47. }
  48. if (res.result.indexOf("type") !== -1) {
  49. if (JSON.parse(res.result).data) {
  50. uni.setStorageSync("rfiCard", JSON.parse(res.result).data)
  51. }
  52. }
  53. that.$goto('activetion');
  54. },
  55. fail: function(a) {},
  56. complete: function(b) {}
  57. })
  58. },
  59. grantMeal() {
  60. var that = this;
  61. uni.scanCode({
  62. scanType: ['qrCode'],
  63. success: function(res) {
  64. uni.setStorageSync("rfiCard", res.result)
  65. that.grantUpLoad(res)
  66. },
  67. fail: function(a) {},
  68. complete: function(b) {}
  69. })
  70. },
  71. toAddressMgtPage() {
  72. uni.setStorageSync("clickType", 0)
  73. this.$goto('addressList')
  74. },
  75. async grantUpLoad(data) {
  76. const {
  77. data: res
  78. } = await this.$httpRequest({
  79. url: '/app/scg?cn=' + data.result + "&on=" + uni.getStorageSync("orgInfo")
  80. .organizationName,
  81. method: 'get',
  82. urlType: this.$getUrlType()
  83. });
  84. if (res.code === 200) {
  85. this.$showModal("发放成功")
  86. } else {
  87. uni.showToast({
  88. duration: 2500,
  89. title: res.msg,
  90. icon: 'error',
  91. });
  92. }
  93. },
  94. async getDataAmassScore(data) {
  95. const {
  96. data: res
  97. } = await this.$httpRequest({
  98. url: '/app/ac?uc=' + uni.getStorageSync("setUserName"),
  99. method: 'get',
  100. urlType: this.$getUrlType()
  101. });
  102. if (res.code === 200) {
  103. this.amassScore = res.data
  104. } else {
  105. uni.showToast({
  106. duration: 2500,
  107. title: res.msg,
  108. icon: 'error',
  109. });
  110. }
  111. }
  112. }
  113. }
  114. </script>
  115. <style>
  116. </style>