storeInfo.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="store-info" v-if="detail.sys_enterpriseid" :style="{
  3. marginTop: tovw(marTop),
  4. marginBottom: tovw(marBot),
  5. }">
  6. <view class="title">
  7. {{ title }}
  8. </view>
  9. <view class="content">
  10. <view style="flex-shrink: 0;">
  11. <u--image width="60" height="62" radius="8" :src="detail.cover" lazy-load>
  12. <template v-slot:loading>
  13. <u-loading-icon color="red"></u-loading-icon>
  14. </template>
  15. </u--image>
  16. </view>
  17. <view class="text-box" hover-class="navigator-hover" @click="goAtOnce(detail)">
  18. <view class="storename u-line-1" :style="{ width: detail.phoneNumber ? '230px' : '100%' }">
  19. {{ detail.storename }}
  20. </view>
  21. <view class="address u-line-1" :style="{ width: detail.phoneNumber ? '230px' : '100%' }">
  22. <text class="iconfont icon-dizhi-hui" />{{ getCity(detail) }}
  23. </view>
  24. <view v-if="detail.phoneNumber" @click.stop="callPhone(detail.phoneNumber)" class="iconfont icon-dianhua"
  25. hover-class="navigator-hover" />
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. name: "storeInfo",
  33. props: {
  34. title: {
  35. type: String,
  36. default: "门店信息"
  37. },
  38. marTop: {
  39. type: [Number || String],
  40. default: 0
  41. },
  42. marBot: {
  43. type: [Number || String],
  44. default: 0
  45. }
  46. },
  47. watch: {
  48. detail: function (newVal) {
  49. this.$emit("门店detail", newVal)
  50. }
  51. },
  52. data() {
  53. return {
  54. detail: uni.getStorageSync("shop") || { sys_enterpriseid: 0 }
  55. }
  56. },
  57. methods: {
  58. goAtOnce(item) {
  59. uni.openLocation({
  60. latitude: item.latitude - 0,
  61. longitude: item.longitude - 0,
  62. address: item.address,
  63. name: item.storename,
  64. success: function () {
  65. console.log('success');
  66. },
  67. fail: (fail) => {
  68. console.log('fail', fail)
  69. },
  70. });
  71. },
  72. },
  73. }
  74. </script>
  75. <style lang="scss" scoped>
  76. .store-info {
  77. background: #fff;
  78. padding: 10px;
  79. padding-top: 12px;
  80. .title {
  81. line-height: 22px;
  82. font-family: PingFang SC, PingFang SC;
  83. font-weight: bold;
  84. font-size: 16px;
  85. color: #333333;
  86. }
  87. .content {
  88. display: flex;
  89. margin-top: 11px;
  90. .text-box {
  91. position: relative;
  92. flex: 1;
  93. height: 62px;
  94. background: #F5F5F5;
  95. border-radius: 5px;
  96. margin-left: 10px;
  97. box-sizing: border-box;
  98. padding: 10px;
  99. .storename {
  100. line-height: 20px;
  101. font-family: PingFang SC, PingFang SC;
  102. font-size: 14px;
  103. color: #333333;
  104. }
  105. .address {
  106. .iconfont {
  107. font-size: 12px;
  108. margin-right: 4px;
  109. }
  110. line-height: 17px;
  111. font-family: PingFang SC,
  112. PingFang SC;
  113. font-size: 12px;
  114. color: #888888;
  115. margin-top: 5px;
  116. }
  117. .icon-dianhua {
  118. position: absolute;
  119. right: 20px;
  120. top: 20px;
  121. font-size: 20px;
  122. color: #C30D23;
  123. }
  124. }
  125. }
  126. }
  127. </style>