index.vue 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. <template>
  2. <view :style="[mainStyle]">
  3. <view :class="'top-fixed' + (skinNotColor ? ' not-color' : '')" :style="'height: '+ systems.barHeight + 'rpx;'">
  4. <view class="top-fixed-c" :style="'height: '+ systems.navigationHeight + 'rpx;margin-top:' + systems.ktxStatusHeight + 'rpx;'">
  5. <navigator url="" hover-class="none" open-type="navigateBack" class="back"><image :src="picUrlss+'back_white.png'"></image></navigator>
  6. <view class="top-title tover" :style="'line-height: '+ systems.navigationHeight + 'rpx;'">详情</view>
  7. </view>
  8. </view>
  9. <view :style="'height:'+(systems.barHeight)+'rpx;'"></view>
  10. <view class="info">
  11. <view class="info-c">
  12. <view class="status ddflex"><image src="../static/images/dai_sy.png"></image>{{params.state == 2?'已使用':'待使用'}}</view>
  13. <view class="infos">
  14. <view class="shop ddflex" v-if="params.showProduct.merchantName"><image src="../static/images/dpico.png"></image>{{params.showProduct.merchantName}}</view>
  15. <view class="product ddflex">
  16. <image :src="params.showProduct.pic" mode="aspectFill"></image>
  17. <view class="fflex">
  18. <view class="pro-tit">{{params.showProduct.title}}</view>
  19. <view class="specs" v-if="params.showProduct.specs">规格<text v-for="(it,index) in params.showProduct.specs" :key="index">{{it.value}}</text></view>
  20. <view class="pro-opt ddflex">
  21. <view class="price"><text>¥</text>{{params.showProduct.money}}</view>
  22. <view class="count">×{{params.showProduct.quantity}}</view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="code ddflex" v-if="params.state == 1">
  27. <u-qrcode ref="qrcode" canvas-id="qrcode" :value="params.code" size="180"></u-qrcode>
  28. </view>
  29. <view class="code-info">
  30. <block v-if="params.state == 1">
  31. <view class="code-sta"><text>待使用</text><block v-if="params.exspireTime">{{params.exspireTime}} 到期</block></view>
  32. <view class="code-ma">{{params.code}}</view>
  33. </block>
  34. <block v-else>
  35. <view class="code-ma">使用时间:{{params.useTime}}</view>
  36. <view class="code-ma">核销门店:{{params.writeMerchant}}</view>
  37. <view class="code-ma">核销人员:{{params.useUser}}</view>
  38. </block>
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. const req = require("../../utils/request.js");
  47. const api = require("../../utils/api.js");
  48. const app = getApp();
  49. export default {
  50. data() {
  51. return {
  52. mainStyle: app.globalData.mainStyle,
  53. picUrlss: req.public.picUrls,
  54. systems: {},
  55. id: '',
  56. params: {},
  57. code: ''
  58. }
  59. },
  60. onLoad(options) {
  61. this.id = options.id;
  62. this.getData();
  63. },
  64. onReachBottom() {
  65. },
  66. methods:{
  67. getData(){
  68. req.getRequest('/api/v3/secondary/card/detail',{id: this.id},data=>{
  69. if (data.showProduct.specs && data.showProduct.specs !== 'DEFAULT_SKU') {
  70. data.showProduct.specs = JSON.parse(data.showProduct.specs);
  71. } else {
  72. data.showProduct.specs = ''
  73. }
  74. this.params = data;
  75. })
  76. },
  77. checks(item,index){
  78. let pageList = this.pageList;
  79. if(pageList[index].isShow){
  80. pageList[index].isShow = false;
  81. this.pageList=JSON.parse(JSON.stringify(pageList))
  82. }else{
  83. pageList.map((it,dx)=>{
  84. if(dx==index) it.isShow = true;
  85. else it.isShow = false;
  86. return it;
  87. });
  88. this.pageList=JSON.parse(JSON.stringify(pageList))
  89. }
  90. },
  91. createCode(item){
  92. this.currentCard = item;
  93. this.isShowCard = true
  94. },
  95. hideCardPop(){
  96. this.isShowCard = false
  97. },
  98. copyCode(){
  99. uni.setClipboardData({
  100. data: this.currentCard.code,
  101. success() {
  102. req.msg('复制成功')
  103. }
  104. })
  105. },
  106. jumpUrl(url) {
  107. uni.navigateTo({
  108. url: url
  109. })
  110. },
  111. scanCode(){
  112. uni.scanCode({
  113. success: function (res) {
  114. console.log('条码类型:' + res.scanType);
  115. console.log('条码内容:' + res.result);
  116. uni.navigateTo({
  117. url: '/mine/secondCard/secondCard?code=' + res.result
  118. })
  119. }
  120. })
  121. }
  122. },
  123. mounted() {
  124. const systemInfo = uni.getSystemInfoSync();
  125. // px转换到rpx的比例
  126. let pxToRpxScale = 750 / systemInfo.windowWidth;
  127. let systems = {
  128. ktxStatusHeight: systemInfo.statusBarHeight * pxToRpxScale, // 状态栏的高度
  129. navigationHeight: 44 * pxToRpxScale // 导航栏的高度
  130. };
  131. systems.barHeight = systems.ktxStatusHeight + systems.navigationHeight;
  132. this.systems = systems;
  133. }
  134. }
  135. </script>
  136. <style>
  137. @import "./index.css"
  138. </style>