index.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  1. <template>
  2. <u-popup :show="popupShow" bgColor="transparent" mask="true" :safeAreaInsetBottom="false" mask-close-able="true" @close="close">
  3. <view class="popupBox">
  4. <view class="popupBox_title">
  5. <image class="popupBox_title_img13" src="https://guess-shop.oss-cn-beijing.aliyuncs.com/static/online/img13.png" mode="" />
  6. <image class="popupBox_title_img12" src="https://guess-shop.oss-cn-beijing.aliyuncs.com/static/online/img12.png" mode="" />
  7. <view>
  8. <view class="popupBox_title_l">卡券详情
  9. <text>凭【核销码】可进入</text>
  10. </view>
  11. </view>
  12. </view>
  13. <view class="popupBox_content">
  14. <view class="">
  15. <view class="list_info">
  16. <image :src="details.businessProductImage||shop.businessImage" mode="" />
  17. <view class="list_info_r">
  18. <view class="list_info_r_title">{{details.businessProductName}}</view>
  19. <view class="list_info_r_hint">{{details.costIncluded||shop.productDataJosn.costIncluded}}</view>
  20. </view>
  21. </view>
  22. <view class="popupBox_content_date">
  23. 有效期:
  24. <text>{{details&&details.expireTime?details.expireTime.replace(/-/g,'.'):''}}之前可用</text>
  25. </view>
  26. <view class="popupBox_content_card">
  27. <view class="popupBox_content_card_item">
  28. <view>
  29. 卡券号:
  30. <text>{{details.couponCode}}</text>
  31. <view class="copy" @click="copyOrderNo()">
  32. <text class="iconfont icon-fuzhi"></text>
  33. </view>
  34. </view>
  35. </view>
  36. <swiper class="swiper" :current="currentIndex" :autoplay="false" @change="swiperChange" v-if="popupShow">
  37. <swiper-item v-for="(v,i) in list" :key="i">
  38. <view class="popupBox_content_card_item">
  39. <view class="popupBox_content_card_c">
  40. <view class="popupBox_content_card_item_l">核销码</view>
  41. <view class="popupBox_content_card_item_r">
  42. <!-- <canvas :id="'qrcode'+i" :canvas-id="'qrcode'+i" style="width: 200px;height: 200px;"></canvas> -->
  43. <view class="qrimg">
  44. <tki-qrcode ref="qrcode" :val="details.couponCode" onval loadMake :size="200" unit="px" />
  45. </view>
  46. <image v-if="v.couponStatus!=0" class="popupBox_content_card_item_r_used" src="https://guess-shop.oss-cn-beijing.aliyuncs.com/static/online/img17.png" mode="" />
  47. <view v-if="v.couponStatus!=0" class="shade"></view>
  48. </view>
  49. </view>
  50. </view>
  51. </swiper-item>
  52. </swiper>
  53. <view class="arrow-left" v-if="currentIndex>0" @click="currentIndex>0?currentIndex--:0"> <u-icon name="arrow-left" color="#666666" size="28"></u-icon></view>
  54. <view class="arrow-right" v-if="currentIndex<list.length-1" @click="(currentIndex<list.length-1)?currentIndex++:0"> <u-icon class="arrow-right" name="arrow-right" color="#666666" size="28"></u-icon></view>
  55. </view>
  56. </view>
  57. </view>
  58. </view>
  59. </u-popup>
  60. </template>
  61. <script>
  62. // import UQRCode from '../../uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
  63. import tkiQrcode from "@/components/tki-qrcode/tki-qrcode.vue"
  64. export default {
  65. components: { tkiQrcode },
  66. data () {
  67. return {
  68. popupShow: false,
  69. details: {},
  70. shop: {},
  71. // list: [],
  72. currentIndex: 0
  73. }
  74. },
  75. props: {
  76. list: {
  77. type: Array,
  78. default: () => { return [] }
  79. }
  80. },
  81. methods: {
  82. open (list, index, shop) {
  83. // open (val, index, shop) {
  84. // this.list = list;
  85. this.shop = shop;
  86. this.currentIndex = index;
  87. this.details = this.list[index];
  88. this.popupShow = true;
  89. // this.initCode(index)
  90. },
  91. initCode (index) {
  92. setTimeout(() => {
  93. var qr = new UQRCode();
  94. // 设置二维码内容
  95. qr.data = this.details.couponCode;
  96. // 设置二维码大小,必须与canvas设置的宽高一致
  97. qr.size = 200;
  98. // 调用制作二维码方法
  99. qr.make();
  100. // 获取canvas上下文
  101. var canvasContext = uni.createCanvasContext('qrcode' + index, this); // 如果是组件,this必须传入
  102. // 设置uQRCode实例的canvas上下文
  103. qr.canvasContext = canvasContext;
  104. // 调用绘制方法将二维码图案绘制到canvas上
  105. qr.drawCanvas();
  106. }, 200)
  107. },
  108. close () {
  109. this.popupShow = false;
  110. this.$emit('close');
  111. },
  112. swiperChange (e) {
  113. this.currentIndex = e.detail.current;
  114. this.details = this.list[this.currentIndex]
  115. this.initCode(this.currentIndex)
  116. },
  117. copyOrderNo () {
  118. uni.setClipboardData({
  119. data: String(this.details.couponCode),
  120. success: () => {
  121. uni.$u.toast("复制成功");
  122. },
  123. });
  124. }
  125. }
  126. }
  127. </script>
  128. <style lang='scss' scoped>
  129. .popupBox {
  130. position: relative;
  131. .popupBox_title {
  132. width: 100%;
  133. position: absolute;
  134. top: -93rpx;
  135. z-index: 10;
  136. > .popupBox_title_img13 {
  137. width: 720rpx;
  138. height: 204rpx;
  139. }
  140. .popupBox_title_img12 {
  141. width: 195rpx;
  142. height: 222rpx;
  143. position: absolute;
  144. top: -59rpx;
  145. right: 27rpx;
  146. }
  147. > view {
  148. display: flex;
  149. align-items: center;
  150. padding: 75rpx 0 0 30rpx;
  151. position: absolute;
  152. top: 0;
  153. left: 0;
  154. .popupBox_title_l {
  155. font-size: 48rpx;
  156. color: #ffffff;
  157. font-family: FZCuYuan-M03;
  158. margin-right: 100rpx;
  159. text {
  160. font-size: 32rpx;
  161. color: #ffffff;
  162. display: inline-block;
  163. margin-left: 20rpx;
  164. }
  165. }
  166. .popupBox_title_r {
  167. .popupBox_title_r_l {
  168. font-size: 26rpx;
  169. color: #ffffff;
  170. text-decoration: line-through;
  171. }
  172. .popupBox_title_r_r {
  173. font-size: 32rpx;
  174. color: #ffffff;
  175. font-family: FZCuYuan-M03;
  176. text-decoration: none;
  177. }
  178. }
  179. }
  180. }
  181. .popupBox_content {
  182. padding: 60rpx 0rpx 0;
  183. background: linear-gradient(180deg, #c90700 0%, #ffe8e6 58%, #ffffff 32%);
  184. border-radius: 40rpx 40rpx 0rpx 0rpx;
  185. background-size: 100% 1900rpx;
  186. background-position-y: -300rpx;
  187. > view {
  188. background: linear-gradient(180deg, #ffedec 0%, #ffffff 39%);
  189. border-radius: 40rpx 40rpx 0rpx 0rpx;
  190. padding: 50rpx 0rpx 20rpx;
  191. position: relative;
  192. z-index: 11;
  193. }
  194. .list_info {
  195. display: flex;
  196. align-items: center;
  197. border-bottom: 1rpx solid #e6e6e6;
  198. padding-bottom: 30rpx;
  199. margin: 0 50rpx;
  200. image {
  201. width: 154rpx;
  202. height: 154rpx;
  203. background: rgba(0, 0, 0, 0);
  204. border-radius: 12rpx;
  205. margin-right: 24rpx;
  206. flex-shrink: 0;
  207. }
  208. .list_info_r {
  209. .list_info_r_title {
  210. font-size: 26rpx;
  211. color: #242424;
  212. font-family: FZCuYuan-M03;
  213. padding-top: 10rpx;
  214. }
  215. .list_info_r_hint {
  216. font-size: 24rpx;
  217. color: #1a1a1a;
  218. margin-top: 10rpx;
  219. }
  220. }
  221. }
  222. .popupBox_content_date {
  223. font-size: 26rpx;
  224. color: #1a1a1a;
  225. padding: 30rpx 50rpx 40rpx;
  226. border-bottom: 1rpx solid #e6e6e6;
  227. text {
  228. font-size: 26rpx;
  229. color: #666666;
  230. }
  231. }
  232. .popupBox_content_card {
  233. border-top: 1rpx solid #e6e6e6;
  234. padding: 44rpx 50rpx;
  235. position: relative;
  236. .arrow-left {
  237. position: absolute;
  238. top: 50%;
  239. left: 75rpx;
  240. }
  241. .arrow-right {
  242. position: absolute;
  243. top: 50%;
  244. right: 75rpx;
  245. }
  246. .swiper {
  247. height: 530rpx;
  248. }
  249. .popupBox_content_card_item {
  250. background: linear-gradient(180deg, #fb2715, #ff0901);
  251. border-radius: 30rpx;
  252. padding: 3rpx;
  253. .copy {
  254. display: inline-block;
  255. margin-left: 30rpx;
  256. }
  257. > view {
  258. font-size: 38rpx;
  259. color: #1a1a1a;
  260. font-family: FZCuYuan-M03;
  261. text-align: center;
  262. background: #ffffff;
  263. border-radius: 30rpx;
  264. padding: 40rpx 0;
  265. }
  266. .popupBox_content_card_item_l {
  267. width: 60rpx;
  268. height: 402rpx;
  269. background: #666666;
  270. border: 1rpx solid #e6e6e6;
  271. border-radius: 10rpx;
  272. box-sizing: border-box;
  273. color: #ffffff;
  274. display: flex;
  275. align-items: center;
  276. }
  277. .popupBox_content_card_item_r {
  278. font-size: 0;
  279. position: relative;
  280. image {
  281. width: 402rpx;
  282. height: 402rpx;
  283. }
  284. .popupBox_content_card_item_r_used {
  285. width: 179rpx;
  286. height: 179rpx;
  287. position: absolute;
  288. right: 0;
  289. bottom: 0;
  290. z-index: 999;
  291. }
  292. .shade {
  293. width: 202px;
  294. height: 202px;
  295. background: rgba(204, 204, 204, 0.6);
  296. position: absolute;
  297. top: 0;
  298. left: 0;
  299. z-index: 99;
  300. }
  301. }
  302. .popupBox_content_card_c {
  303. display: flex;
  304. align-items: center;
  305. justify-content: center;
  306. }
  307. }
  308. }
  309. }
  310. }
  311. </style>