about.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  1. <template>
  2. <view class="pages">
  3. <u-navbar
  4. :title="navbarTitle"
  5. :autoBack="true"
  6. :safeAreaInsetTop="true"
  7. >
  8. </u-navbar>
  9. <view class="page-wrap">
  10. <u-subsection
  11. class="subsection"
  12. :customStyle="{height: '66rpx'}"
  13. :list="typeList"
  14. mode="subsection"
  15. activeColor="#00A447"
  16. @change="sectionChange"
  17. :current="curNow"></u-subsection>
  18. <view class="content">
  19. <view class="" v-if="curNow==0">
  20. <!-- <view class="name">贵州旭烁食品有限公司简介</view> -->
  21. <view class="u-content" style="margin-top: 40rpx;">
  22. <u-parse :content="pageData.xsIntro"></u-parse>
  23. </view>
  24. <view class="contact">
  25. <view class="item">联系电话:{{pageData.xsMobile}}</view>
  26. <view class="item">营业世间:{{pageData.xsServiceTime}}</view>
  27. <view class="item">旭烁地址:{{pageData.xsAddress}}</view>
  28. </view>
  29. </view>
  30. <view class="" v-if="curNow==1">
  31. <view class="u-content" style="margin-top: 40rpx;">
  32. <u-parse :content="pageData.shopIntro"></u-parse>
  33. </view>
  34. <view class="contact">
  35. <view class="item">联系电话:{{pageData.shopMobile}}</view>
  36. <view class="item">营业世间:{{pageData.shopServiceTime}}</view>
  37. <view class="item">商行地址:{{pageData.shopAddress}}</view>
  38. </view>
  39. </view>
  40. <!-- <img :src="pageData.uxImg" style="width: 100%;" alt=""> -->
  41. <view class="map-wrap" @click="mapClick">
  42. <map style="width: 100%; height: 340rpx;"
  43. :latitude="curNow==0?xsLatitude:shopLatitude"
  44. :longitude="curNow==0?xsLongitude:shopLongitude" :markers="covers">
  45. </map>
  46. </view>
  47. </view>
  48. </view>
  49. </view>
  50. </template>
  51. <script>
  52. export default {
  53. components:{
  54. },
  55. data() {
  56. return {
  57. staticUrl:this.$commonConfig.staticUrl,
  58. shopLatitude: 30.659462,
  59. shopLongitude: 104.065735,
  60. xsLatitude: 30.659462,
  61. xsLongitude: 104.065735,
  62. covers: [], //存放标记点数组
  63. navbarTitle:'',
  64. typeList:['旭烁简介','商行简介'],
  65. curNow:0,
  66. pageData:{}
  67. }
  68. },
  69. watch:{
  70. curNow: {
  71. handler(newVal, oldVal){
  72. console.log('newVal',newVal);
  73. this.navbarTitle = this.typeList[newVal];
  74. this.getIntro();
  75. },
  76. immediate: true
  77. }
  78. },
  79. onLoad() {
  80. },
  81. methods: {
  82. sectionChange(index){
  83. this.curNow = index;
  84. },
  85. getIntro(){
  86. let type = this.curNow + 1;
  87. this.$u.api.xsGetIntro({type:type}).then(res=>{
  88. this.pageData = res.data;
  89. this.shopLatitude = res.data.shopLatitude;
  90. this.shopLongitude = res.data.shopLongitude;
  91. this.xsLatitude = res.data.xsLatitude;
  92. this.xsLongitude = res.data.xsLongitude;
  93. if(this.curNow==0){
  94. this.setCovers(this.xsLatitude,this.xsLongitude);
  95. }else{
  96. this.setCovers(this.shopLatitude,this.shopLongitude);
  97. }
  98. // console.log('res',res);
  99. }).catch(err=>{
  100. console.log('xsGetIntro',err.data);
  101. })
  102. },
  103. //设置点位
  104. setCovers(latitude, longitude) {
  105. let location = {
  106. id: 0,
  107. latitude: Number(latitude),
  108. longitude: Number(longitude),
  109. width: uni.upx2px(50),
  110. height: uni.upx2px(55),
  111. iconPath:this.$commonConfig.staticUrl+ '/img/mapicon.png'
  112. // iconPath: './../../static/location.png'
  113. }
  114. this.covers = [location]
  115. },
  116. mapClick(){
  117. if(this.curNow==0){
  118. uni.openLocation({
  119. latitude:this.xsLatitude, //维度
  120. longitude: this.xsLongitude, //经度
  121. name: "旭烁地址", //目的地定位名称
  122. scale: 15, //缩放比例
  123. address: this.pageData.xsAddress //导航详细地址
  124. })
  125. }else{
  126. uni.openLocation({
  127. latitude:this.shopLatitude, //维度
  128. longitude: this.shopLongitude, //经度
  129. name: "商行地址", //目的地定位名称
  130. scale: 15, //缩放比例
  131. address: this.pageData.shopAddress //导航详细地址
  132. })
  133. }
  134. }
  135. }
  136. }
  137. </script>
  138. <style>
  139. page{
  140. background-color: #F9F9F9;
  141. }
  142. </style>
  143. <style lang="scss" scoped>
  144. .content{
  145. font-size: 26rpx;
  146. font-weight: 400;
  147. color: #666666;
  148. line-height: 44rpx;
  149. .name{
  150. font-size: 32rpx;
  151. font-weight: 600;
  152. color: #333333;
  153. line-height: 45rpx;
  154. text-align: center;
  155. margin-top: 34rpx;
  156. margin-bottom: 30rpx;
  157. }
  158. .title{
  159. font-size: 30rpx;
  160. font-weight: 400;
  161. color: #333333;
  162. line-height: 50rpx;
  163. margin: 30rpx auto 15rpx;
  164. }
  165. .xsIntro{
  166. font-size: 24rpx;
  167. font-weight: 400;
  168. color: #999999;
  169. line-height: 33rpx;
  170. margin: 20rpx auto 50rpx;
  171. }
  172. .contact{
  173. margin: 30rpx 0;
  174. font-size: 32rpx;
  175. font-weight: 400;
  176. color: #333333;
  177. line-height: 50rpx;
  178. .item{
  179. margin-bottom: 10rpx;
  180. }
  181. }
  182. }
  183. .map-wrap{
  184. margin: 20rpx 0;
  185. }
  186. </style>