app-card-detail.vue 6.9 KB

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