app-card-detail.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290
  1. <template>
  2. <view class="page">
  3. <view class="view" v-if="list">
  4. <view class='card'>
  5. <image class='card-img' :src='list.pic_url'></image>
  6. <view class='card-name'>{{list.card_name}}</view>
  7. <view class="dir-left-nowrap main-center" v-if="list.status == 0">
  8. <view class="over over-lg dir-left-nowrap cross-top box-grow-0">
  9. <image src="/static/image/icon/icon_ok.png" class="icon_ok box-grow-0"></image>
  10. <view class="box-grow-1" style="height: 100%;">
  11. <view>已转赠给:{{list.receive_user_name}}</view>
  12. </view>
  13. <image src="/static/image/card/img_seal.png" class="img_seal"></image>
  14. </view>
  15. </view>
  16. <view class="qr" v-else-if="list.status == 1">
  17. <view class="give-btn" :class="theme + ' ' + theme + '-m-text ' + theme + '-m-border'"
  18. v-if="list.is_allow_send == 1"
  19. @click="shareShow = true">转赠
  20. </view>
  21. <image :src='file_path' v-if="list.is_use === 0"></image>
  22. <view>
  23. <app-share-qr-code v-model="shareShow" title="生成碎屏险海报"
  24. :poster-url="`/pages/poster/poster?card_id=` + list.id"
  25. :has-poster-nav="true" :is-show-friend="list.is_allow_send == 1"
  26. ></app-share-qr-code>
  27. </view>
  28. </view>
  29. <view class="over" v-else-if="list.status == 2">已使用</view>
  30. <view class="over" v-else>已过期</view>
  31. </view>
  32. <view class='line'>
  33. <image src='/static/image/icon/line.png'></image>
  34. </view>
  35. <view class='explain use-time' v-if="list.is_show_history">
  36. <view class='explain-title'>核销时间</view>
  37. <view class="clerk-history">
  38. <view>{{list.clerked_at}}</view>
  39. <view @click="isShow = true" class="history-button">查看历史</view>
  40. </view>
  41. </view>
  42. <view class='explain use-time'>
  43. <view class='explain-title'>有效时间</view>
  44. <view>{{list.start_time}} - {{list.end_time}}</view>
  45. </view>
  46. <view class='explain card-info'>
  47. <view class='explain-title'>使用说明</view>
  48. <view>
  49. <text style="word-break: break-all;">{{list.content}}</text>
  50. </view>
  51. </view>
  52. <view class='explain card-info-2'>
  53. <view class='explain-title'>核销信息</view>
  54. <view class="clerk-info">
  55. <view class="clerk-item">
  56. <view>剩余次数:</view>
  57. <view>{{list.number - list.use_number}}次</view>
  58. </view>
  59. <view class="clerk-item">
  60. <view>已核销次数:</view>
  61. <view>{{list.use_number}}次</view>
  62. </view>
  63. <view class="clerk-item">
  64. <view>总次数:</view>
  65. <view>{{list.number}}次</view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. <app-clerk-historys :user-card-id="list.id" :is-show.sync="isShow"></app-clerk-historys>
  71. </view>
  72. </template>
  73. <script>
  74. import {mapState} from "vuex";
  75. import {mapGetters} from "vuex";
  76. import appClerkHistorys from '../../../components/page-component/app-clerk-historys/app-clerk-historys.vue';
  77. import appShareQrCode
  78. from '../../../components/page-component/app-share-qr-code-poster/app-share-qr-code-poster.vue';
  79. export default {
  80. name: "app-card-detail",
  81. components: {appClerkHistorys, appShareQrCode},
  82. props: {
  83. list: {
  84. type: Object | null,
  85. default() {
  86. return null
  87. }
  88. },
  89. },
  90. data() {
  91. return {
  92. isShow: false,
  93. shareShow: false,
  94. file_path: '',
  95. }
  96. },
  97. computed: {
  98. ...mapGetters('mallConfig', {
  99. theme: 'getTheme',
  100. }),
  101. },
  102. watch: {
  103. list() {
  104. if (this.list.status == 1) {
  105. this.$request({
  106. url: this.$api.card.sqrcode,
  107. data: {
  108. cardId: this.list.id,
  109. },
  110. }).then(response=>{
  111. if(response.code === 0) {
  112. this.file_path = response.data.file_path;
  113. }else {
  114. uni.showToast({
  115. title: response.msg,
  116. icon: 'none',
  117. duration: 1000,
  118. });
  119. }
  120. }).catch(() => {
  121. });
  122. }
  123. }
  124. }
  125. }
  126. </script>
  127. <style scoped lang="scss">
  128. .page {
  129. min-height: 100vh;
  130. background-color: #ff7b33;
  131. width: 100%;
  132. }
  133. .view {
  134. background-color: #ff7b33;
  135. padding: #{72rpx} #{24rpx};
  136. position: relative;
  137. }
  138. .card {
  139. background-color: #fff;
  140. border-top-left-radius: #{16rpx};
  141. border-top-right-radius: #{16rpx};
  142. padding: #{90rpx} #{40rpx} #{24rpx};
  143. }
  144. .card-info {
  145. background-color: #fff;
  146. }
  147. .card-img {
  148. position: absolute;
  149. top: #{32rpx};
  150. left: 50%;
  151. margin-left: #{-44rpx};
  152. height: #{88rpx};
  153. width: #{88rpx};
  154. border-radius: 50%;
  155. }
  156. .card-name {
  157. text-align: center;
  158. font-size: #{50rpx};
  159. margin-bottom: #{31rpx};
  160. color: #353535;
  161. }
  162. .over {
  163. width: #{240rpx};
  164. height: #{64rpx};
  165. text-align: center;
  166. color: #999;
  167. font-size: #{30rpx};
  168. line-height: #{64rpx};
  169. border-radius: #{32rpx};
  170. background-color: #f7f7f7;
  171. margin: 0 auto;
  172. }
  173. .line {
  174. height: #{48rpx};
  175. width: 100%;
  176. }
  177. .line image {
  178. height: 100%;
  179. width: 100%;
  180. }
  181. .explain {
  182. background-color: #fff;
  183. padding: #{20rpx} #{40rpx};
  184. font-size: #{28rpx};
  185. color: #353535;
  186. }
  187. .explain.use-time {
  188. padding-bottom: #{20rpx};
  189. }
  190. .explain-title {
  191. font-size: #{26rpx};
  192. color: #999;
  193. margin-bottom: #{15rpx};
  194. }
  195. .qr {
  196. width: #{400rpx};
  197. display: block;
  198. margin: 0 auto;
  199. }
  200. .qr image {
  201. height: #{400rpx};
  202. width: 100%
  203. }
  204. .clerk-info {
  205. display: flex;
  206. flex-direction: column;
  207. .clerk-item {
  208. display: flex;
  209. }
  210. }
  211. .card-info-2 {
  212. background-color: #fff;
  213. border-bottom-left-radius: #{16rpx};
  214. border-bottom-right-radius: #{16rpx};
  215. padding-bottom: 60#{rpx};
  216. }
  217. .clerk-history {
  218. display: flex;
  219. align-items: center;
  220. .history-button {
  221. width: 125#{rpx};
  222. height: 48#{rpx};
  223. border-radius: 30#{rpx};
  224. margin-left: 10#{rpx};
  225. font-size: #{22rpx};
  226. color: #ac450d;
  227. background: #ffeda9;
  228. display: flex;
  229. justify-content: center;
  230. align-items: center;
  231. }
  232. }
  233. .over.over-lg {
  234. width: auto;
  235. padding: #{0 34rpx};
  236. height: auto;
  237. margin: 0;
  238. max-width: 100%;
  239. }
  240. .over .icon_ok {
  241. width: #{32rpx};
  242. height: #{32rpx};
  243. margin-right: #{15rpx};
  244. margin-top: #{15rpx};
  245. }
  246. .give-btn {
  247. width: #{240rpx};
  248. height: #{64rpx};
  249. line-height: #{64rpx};
  250. border-radius: #{32rpx};
  251. border: #{1rpx solid};
  252. text-align: center;
  253. transform: rotateZ(360deg);
  254. margin: #{0 auto 46rpx auto};
  255. }
  256. .img_seal {
  257. position: absolute;
  258. bottom: #{132rpx};
  259. right: #{84rpx};
  260. width: #{150rpx};
  261. height: #{117rpx};
  262. display: block;
  263. }
  264. </style>