pickUpVerify.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="order-details">
  3. <!-- 自提商品核销 -->
  4. <view v-if="orderInfo.deliveryType === 2 && orderInfo.payStatus" class="writeOff borRadius14">
  5. <view class="title">核销信息</view>
  6. <view class="grayBg flex-center">
  7. <view class="pictrue">
  8. <image
  9. v-if="!!painterImageUrl"
  10. :src="painterImageUrl"
  11. :style="{ width: `${state.qrcodeSize}px`, height: `${state.qrcodeSize}px` }"
  12. :show-menu-by-longpress="true"
  13. />
  14. </view>
  15. </view>
  16. <view class="gear">
  17. <image :src="sheep.$url.static('/static/img/shop/writeOff.png')"></image>
  18. </view>
  19. <view class="num">{{ orderInfo.pickUpVerifyCode }}</view>
  20. <view class="rules">
  21. <view class="item">
  22. <view class="rulesTitle flex flex-wrap align-center"> 核销时间 </view>
  23. <view class="info">
  24. 每日:
  25. <text class="time">{{ systemStore.openingTime }} - {{ systemStore.closingTime }}</text>
  26. </view>
  27. </view>
  28. <view class="item">
  29. <view class="rulesTitle flex flex-wrap align-center">
  30. <text class="iconfont icon-shuoming1"></text>
  31. 使用说明
  32. </view>
  33. <view class="info">可将二维码出示给店员扫描或提供数字核销码</view>
  34. </view>
  35. </view>
  36. </view>
  37. <view
  38. v-if="orderInfo.deliveryType === 2"
  39. class="map flex flex-wrap align-center ss-row-between borRadius14"
  40. >
  41. <view>自提地址信息</view>
  42. <view class="place cart-color flex flex-wrap flex-center" @tap="showMaoLocation">
  43. 查看位置
  44. </view>
  45. </view>
  46. <!-- 海报画板:默认隐藏只用来生成海报。生成方式为主动调用 -->
  47. <l-painter
  48. v-if="showPainter"
  49. isCanvasToTempFilePath
  50. pathType="url"
  51. @success="setPainterImageUrl"
  52. hidden
  53. ref="painterRef"
  54. />
  55. </view>
  56. </template>
  57. <script setup>
  58. import sheep from '@/sheep';
  59. import { reactive, ref } from 'vue';
  60. const props = defineProps({
  61. orderInfo: {
  62. type: Object,
  63. default() {},
  64. },
  65. systemStore: {
  66. type: Object,
  67. default() {},
  68. },
  69. });
  70. const state = reactive({
  71. qrcodeSize: 145,
  72. });
  73. /**
  74. * 打开地图
  75. */
  76. const showMaoLocation = () => {
  77. if (!props.systemStore.latitude || !props.systemStore.longitude) {
  78. sheep.$helper.toast('缺少经纬度信息无法查看地图!');
  79. return;
  80. }
  81. uni.openLocation({
  82. latitude: props.systemStore.latitude,
  83. longitude: props.systemStore.longitude,
  84. scale: 8,
  85. name: props.systemStore.name,
  86. address: props.systemStore.areaName + props.systemStore.detailAddress,
  87. });
  88. };
  89. /**
  90. * 拨打电话
  91. */
  92. const makePhone = () => {
  93. uni.makePhoneCall({
  94. phoneNumber: props.systemStore.phone,
  95. });
  96. };
  97. const painterRef = ref(); // 海报画板
  98. const painterImageUrl = ref(); // 海报 url
  99. const showPainter = ref(true);
  100. // 渲染海报
  101. const renderPoster = async (poster) => {
  102. await painterRef.value.render(poster);
  103. };
  104. // 获得生成的图片
  105. const setPainterImageUrl = (path) => {
  106. painterImageUrl.value = path;
  107. showPainter.value = false;
  108. };
  109. /**
  110. * 生成核销二维码
  111. */
  112. const markCode = (text) => {
  113. renderPoster({
  114. css: {
  115. width: `${state.qrcodeSize}px`,
  116. height: `${state.qrcodeSize}px`,
  117. },
  118. views: [
  119. {
  120. type: 'qrcode',
  121. text: text,
  122. css: {
  123. width: `${state.qrcodeSize}px`,
  124. height: `${state.qrcodeSize}px`,
  125. },
  126. },
  127. ],
  128. });
  129. };
  130. defineExpose({
  131. markCode,
  132. });
  133. </script>
  134. <style scoped lang="scss">
  135. .borRadius14 {
  136. border-radius: 14rpx !important;
  137. }
  138. .cart-color {
  139. color: #e93323 !important;
  140. border: 1px solid #e93323 !important;
  141. }
  142. .order-details {
  143. border-radius: 10rpx;
  144. margin: 0 20rpx 20rpx 20rpx;
  145. }
  146. .order-details .writeOff {
  147. background-color: #fff;
  148. margin-top: 15rpx;
  149. padding-bottom: 50rpx;
  150. }
  151. .order-details .writeOff .title {
  152. font-size: 30rpx;
  153. color: #282828;
  154. height: 87rpx;
  155. border-bottom: 1px solid #f0f0f0;
  156. padding: 0 24rpx;
  157. line-height: 87rpx;
  158. }
  159. .order-details .writeOff .grayBg {
  160. background-color: #f2f5f7;
  161. width: 590rpx;
  162. height: 384rpx;
  163. border-radius: 20rpx 20rpx 0 0;
  164. margin: 50rpx auto 0 auto;
  165. padding-top: 55rpx;
  166. }
  167. .order-details .writeOff .grayBg .pictrue {
  168. width: 290rpx;
  169. height: 290rpx;
  170. }
  171. .order-details .writeOff .grayBg .pictrue image {
  172. width: 100%;
  173. height: 100%;
  174. }
  175. .order-details .writeOff .gear {
  176. width: 590rpx;
  177. height: 30rpx;
  178. margin: 0 auto;
  179. }
  180. .order-details .writeOff .gear image {
  181. width: 100%;
  182. height: 100%;
  183. }
  184. .order-details .writeOff .num {
  185. background-color: #f0c34c;
  186. width: 590rpx;
  187. height: 84rpx;
  188. color: #282828;
  189. font-size: 48rpx;
  190. margin: 0 auto;
  191. border-radius: 0 0 20rpx 20rpx;
  192. text-align: center;
  193. padding-top: 4rpx;
  194. }
  195. .order-details .writeOff .rules {
  196. margin: 46rpx 30rpx 0 30rpx;
  197. border-top: 1px solid #f0f0f0;
  198. padding-top: 10rpx;
  199. }
  200. .order-details .writeOff .rules .item {
  201. margin-top: 20rpx;
  202. }
  203. .order-details .writeOff .rules .item .rulesTitle {
  204. font-size: 28rpx;
  205. color: #282828;
  206. }
  207. .order-details .writeOff .rules .item .rulesTitle .iconfont {
  208. font-size: 30rpx;
  209. color: #333;
  210. margin-right: 8rpx;
  211. margin-top: 5rpx;
  212. }
  213. .order-details .writeOff .rules .item .info {
  214. font-size: 28rpx;
  215. color: #999;
  216. margin-top: 7rpx;
  217. }
  218. .order-details .writeOff .rules .item .info .time {
  219. margin-left: 20rpx;
  220. }
  221. .order-details .map {
  222. height: 86rpx;
  223. font-size: 30rpx;
  224. color: #282828;
  225. line-height: 86rpx;
  226. border-bottom: 1px solid #f0f0f0;
  227. margin-top: 15rpx;
  228. background-color: #fff;
  229. padding: 0 24rpx;
  230. }
  231. .order-details .map .place {
  232. font-size: 26rpx;
  233. width: 176rpx;
  234. height: 50rpx;
  235. border-radius: 25rpx;
  236. line-height: 50rpx;
  237. text-align: center;
  238. }
  239. </style>