app-card-detail.vue 8.6 KB

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