pickUpVerify.vue 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260
  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/images/writeOff.png', 'local')"></image>
  18. </view>
  19. <view class="num">{{ orderInfo.pickUpVerifyCode }}</view>
  20. <view class="rules">
  21. <!-- TODO puhui999: 需要后端放回:使用 receiveTime 即可 -->
  22. <view class="item">
  23. <view class="rulesTitle flex flex-wrap align-center">
  24. 核销时间
  25. </view>
  26. <view class="info">
  27. 每日:
  28. <text class="time">2020-2-+52</text>
  29. </view>
  30. </view>
  31. <view class="item">
  32. <view class="rulesTitle flex flex-wrap align-center">
  33. <text class="iconfont icon-shuoming1"></text>
  34. 使用说明
  35. </view>
  36. <view class="info">可将二维码出示给店员扫描或提供数字核销码</view>
  37. </view>
  38. </view>
  39. </view>
  40. <view v-if="orderInfo.deliveryType === 2" class="map flex flex-wrap align-center ss-row-between borRadius14">
  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. console.log(props.systemStore);
  78. if (!props.systemStore.latitude || !props.systemStore.longitude) {
  79. sheep.$helper.toast('缺少经纬度信息无法查看地图!');
  80. return
  81. }
  82. uni.openLocation({
  83. latitude: props.systemStore.latitude,
  84. longitude: props.systemStore.longitude,
  85. scale: 8,
  86. name: props.systemStore.name,
  87. address: props.systemStore.areaName + props.systemStore.detailAddress,
  88. });
  89. }
  90. /**
  91. * 拨打电话
  92. */
  93. const makePhone = () => {
  94. uni.makePhoneCall({
  95. phoneNumber: props.systemStore.phone
  96. })
  97. }
  98. const painterRef = ref(); // 海报画板
  99. const painterImageUrl = ref(); // 海报 url
  100. const showPainter = ref(true)
  101. // 渲染海报
  102. const renderPoster = async (poster) => {
  103. await painterRef.value.render(poster);
  104. };
  105. // 获得生成的图片
  106. const setPainterImageUrl = (path) => {
  107. painterImageUrl.value = path;
  108. showPainter.value = false
  109. };
  110. /**
  111. * 生成核销二维码
  112. */
  113. const markCode = (text) => {
  114. renderPoster({
  115. css: {
  116. width: `${state.qrcodeSize}px`,
  117. height: `${state.qrcodeSize}px`
  118. },
  119. views:[
  120. {
  121. type: 'qrcode',
  122. text: text,
  123. css: {
  124. width: `${state.qrcodeSize}px`,
  125. height: `${state.qrcodeSize}px`
  126. }
  127. }
  128. ]
  129. })
  130. }
  131. defineExpose({
  132. markCode
  133. })
  134. </script>
  135. <style scoped lang="scss">
  136. .borRadius14 {
  137. border-radius: 14rpx !important;
  138. }
  139. .cart-color {
  140. color: #E93323 !important;
  141. border: 1px solid #E93323 !important
  142. }
  143. .order-details{
  144. border-radius: 10rpx;
  145. margin: 0 20rpx 20rpx 20rpx;
  146. }
  147. .order-details .writeOff {
  148. background-color: #fff;
  149. margin-top: 15rpx;
  150. padding-bottom: 50rpx;
  151. }
  152. .order-details .writeOff .title {
  153. font-size: 30rpx;
  154. color: #282828;
  155. height: 87rpx;
  156. border-bottom: 1px solid #f0f0f0;
  157. padding: 0 24rpx;
  158. line-height: 87rpx;
  159. }
  160. .order-details .writeOff .grayBg {
  161. background-color: #f2f5f7;
  162. width: 590rpx;
  163. height: 384rpx;
  164. border-radius: 20rpx 20rpx 0 0;
  165. margin: 50rpx auto 0 auto;
  166. padding-top: 55rpx;
  167. }
  168. .order-details .writeOff .grayBg .pictrue {
  169. width: 290rpx;
  170. height: 290rpx;
  171. }
  172. .order-details .writeOff .grayBg .pictrue image {
  173. width: 100%;
  174. height: 100%;
  175. }
  176. .order-details .writeOff .gear {
  177. width: 590rpx;
  178. height: 30rpx;
  179. margin: 0 auto;
  180. }
  181. .order-details .writeOff .gear image {
  182. width: 100%;
  183. height: 100%;
  184. }
  185. .order-details .writeOff .num {
  186. background-color: #f0c34c;
  187. width: 590rpx;
  188. height: 84rpx;
  189. color: #282828;
  190. font-size: 48rpx;
  191. margin: 0 auto;
  192. border-radius: 0 0 20rpx 20rpx;
  193. text-align: center;
  194. padding-top: 4rpx;
  195. }
  196. .order-details .writeOff .rules {
  197. margin: 46rpx 30rpx 0 30rpx;
  198. border-top: 1px solid #f0f0f0;
  199. padding-top: 10rpx;
  200. }
  201. .order-details .writeOff .rules .item {
  202. margin-top: 20rpx;
  203. }
  204. .order-details .writeOff .rules .item .rulesTitle {
  205. font-size: 28rpx;
  206. color: #282828;
  207. }
  208. .order-details .writeOff .rules .item .rulesTitle .iconfont {
  209. font-size: 30rpx;
  210. color: #333;
  211. margin-right: 8rpx;
  212. margin-top: 5rpx;
  213. }
  214. .order-details .writeOff .rules .item .info {
  215. font-size: 28rpx;
  216. color: #999;
  217. margin-top: 7rpx;
  218. }
  219. .order-details .writeOff .rules .item .info .time {
  220. margin-left: 20rpx;
  221. }
  222. .order-details .map {
  223. height: 86rpx;
  224. font-size: 30rpx;
  225. color: #282828;
  226. line-height: 86rpx;
  227. border-bottom: 1px solid #f0f0f0;
  228. margin-top: 15rpx;
  229. background-color: #fff;
  230. padding: 0 24rpx;
  231. }
  232. .order-details .map .place {
  233. font-size: 26rpx;
  234. width: 176rpx;
  235. height: 50rpx;
  236. border-radius: 25rpx;
  237. line-height: 50rpx;
  238. text-align: center;
  239. }
  240. </style>