storeInfo.vue 3.6 KB

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