index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <style lang="scss">
  2. .app-body{
  3. padding: 20rpx 0;
  4. }
  5. .top-info{
  6. background: #fff;
  7. padding: 20rpx;
  8. .merchant-info{
  9. border-bottom: 1px solid #F1F1F1;
  10. padding-bottom: 20rpx;
  11. .img{
  12. width: 80px;
  13. height: 80px;
  14. border-radius: 8rpx;
  15. }
  16. .info{
  17. margin-left: 20rpx;
  18. .title{
  19. font-weight: bold;
  20. font-size: 36rpx;
  21. color: #000000;
  22. }
  23. .dm{
  24. image{width: 20rpx;height: 28rpx;margin-right: 8rpx}
  25. font-weight: 400;
  26. font-size: 22rpx;
  27. color: #666666;
  28. margin-top: 40rpx;
  29. }
  30. }
  31. }
  32. .top-foot{
  33. padding: 20rpx 0;
  34. position: relative;
  35. .left{
  36. .address{
  37. font-weight: bold;
  38. font-size: 24rpx;
  39. color: #101010;
  40. }
  41. .business{
  42. font-size: 24rpx;
  43. color: #666666;
  44. margin-top: 10rpx;
  45. }
  46. }
  47. .right{
  48. .wline{
  49. margin: 0px 24rpx;
  50. height: 40rpx;
  51. width: 1px;
  52. background: #eee;
  53. }
  54. .witem{
  55. image{
  56. width: 46rpx;
  57. height: 46rpx;
  58. }
  59. .text{
  60. font-size: 12px;
  61. color: #666666;
  62. }
  63. }
  64. }
  65. }
  66. }
  67. .pannel{
  68. background: #fff;
  69. margin-top: 20rpx;
  70. padding: 40rpx;
  71. padding-bottom: 20rpx;
  72. .title{
  73. font-weight: bold;
  74. font-size: 30rpx;
  75. color: #464646;
  76. }
  77. .items{
  78. margin-top: 20rpx;
  79. .item{
  80. width: calc(50% - 10rpx);
  81. margin-right: 10rpx;
  82. margin-left: 0;
  83. margin-bottom: 10rpx;
  84. &:nth-child(2n) {
  85. margin-left: 10rpx;
  86. margin-right: 0;
  87. }
  88. image{
  89. width: 100%;
  90. height: 240rpx;
  91. }
  92. }
  93. }
  94. }
  95. .foot{
  96. position:fixed;
  97. bottom: 0;
  98. width: 100%;
  99. background: #fff;
  100. height: 120rpx;
  101. box-shadow: 0px 0px 20px 0px rgba(50,50,52,0.06);
  102. .sbtn{
  103. width: 40vw;
  104. height: 80rpx;
  105. background: linear-gradient(180deg, #FFA30B, #FFD158);
  106. box-shadow: 0px 4rpx 14rpx 4rpx rgba(255,164,13,0.48);
  107. border-radius: 40rpx;
  108. font-size: 32rpx;
  109. color: #FFFFFF;
  110. line-height: 80rpx;
  111. text-align: center;
  112. margin-right: 3vw;
  113. }
  114. .sbtn2{
  115. width: 40vw;
  116. height: 80rpx;
  117. background: linear-gradient(180deg, #FF6223, #FFAB60);
  118. box-shadow: 0px 4rpx 14rpx 4rpx rgba(255,111,46,0.48);
  119. border-radius: 40rpx;
  120. font-size: 32rpx;
  121. color: #FFFFFF;
  122. line-height: 80rpx;
  123. text-align: center;
  124. margin-left: 3vw;
  125. }
  126. }
  127. </style>
  128. <template>
  129. <view class="app-body">
  130. <view class="top-info">
  131. <view class="merchant-info fx-r">
  132. <image class="img" :src="data.logo" mode="aspectFill"></image>
  133. <view class="info">
  134. <view class="title">{{ data.name || "" }}</view>
  135. <view class="dm fx-r fx-bc">
  136. <image src="/static/img/shop-small-location.png"></image>
  137. 距离{{data.dis_km || '无' }}
  138. </view>
  139. </view>
  140. </view>
  141. <view class="top-foot fx-r fx-bc fx-ac">
  142. <view class="left">
  143. <view class="address">地址:{{ data.address || "-无-" }}</view>
  144. <view class="business">营业时间:{{ data.business || "-" }}</view>
  145. </view>
  146. <view class="fx-g1"></view>
  147. <view class="right fx-r fx-bc">
  148. <view class="witem fx-h fx-bc fx-ac" @tap="tapTel(data)">
  149. <image src="/static/img/shop-tel.png"></image>
  150. <view class="text">电话</view>
  151. </view>
  152. <view class="wline"></view>
  153. <view class="witem fx-h fx-bc fx-ac" @tap="tapLbs(data)">
  154. <image src="/static/img/shop-location.png"></image>
  155. <view class="text">导航</view>
  156. </view>
  157. </view>
  158. </view>
  159. </view>
  160. <view class="pannel">
  161. <view class="title">门头照片</view>
  162. <view class="items fx-r">
  163. <view class="item " v-for="(item,index) in data.imgs">
  164. <image mode="aspectFill" :src="item" @tap="tapImg(data.imgs,index)"></image>
  165. </view>
  166. <view class="fx-h fx-bc fx-ac" style="width: 100%;" v-if="data.imgs.length == 0">
  167. <image src="/static/img/no-empty.png" style="width: 40vw; height: 40vw;"></image>
  168. </view>
  169. </view>
  170. </view>
  171. <view class="pannel">
  172. <view class="title">店门图片</view>
  173. <view class="items fx-r">
  174. <view class="item " v-for="(item,index) in data.content_imgs">
  175. <image mode="aspectFill" :src="item" @tap="tapImg(data.content_imgs,index)"></image>
  176. </view>
  177. <view class="fx-h fx-bc fx-ac" style="width: 100%;" v-if="data.content_imgs.length == 0">
  178. <image src="/static/img/no-empty.png" style="width: 40vw; height: 40vw;"></image>
  179. </view>
  180. </view>
  181. </view>
  182. <view style="height: 120rpx;"></view>
  183. <view class="foot fx-r fx-bc fx-ac">
  184. <view class="sbtn" @tap="tapTel(data)">联系商家</view>
  185. <view class="sbtn2" @tap="tapLbs(data)">导航到店</view>
  186. </view>
  187. </view>
  188. </template>
  189. <script>
  190. import {mapState,mapMutations } from 'vuex';
  191. export default {
  192. ...mapState(['user','lbs']),
  193. data() {
  194. return {
  195. data : {
  196. imgs : [],
  197. content_imgs : []
  198. },
  199. id : 0,
  200. isShow : false
  201. }
  202. },
  203. onLoad(options) {
  204. this.id = options.id || 0;
  205. this.initView();
  206. },
  207. methods: {
  208. ...mapMutations(['checkUserLogin']),
  209. /**
  210. * 加载基础配置
  211. */
  212. initView:function(){
  213. let post = {};
  214. post.id = this.id;
  215. if(this.lbs != null) {
  216. post.lat = this.utils.isDefine(this.lbs.latitude) ? this.lbs.latitude : 0 ;
  217. post.lng = this.utils.isDefine(this.lbs.longitude) ? this.lbs.longitude : 0 ;
  218. }
  219. uni.showLoading({ title: '获取数据中..' });
  220. this
  221. .request
  222. .post("merchantItem",post)
  223. .then(res => {
  224. uni.hideLoading();
  225. if (res.code == 200) {
  226. this.data = res.data;
  227. } else {
  228. this.utils.Tip(res.msg);
  229. }
  230. })
  231. .catch((res)=>{
  232. console.log(res);
  233. uni.hideLoading();
  234. uni.showModal({title: '系统提示',content: '加载失败,返回在尝试',showCancel: false});
  235. });
  236. },
  237. /**
  238. * 打开详情
  239. * @param {Object} type
  240. * @param {Object} index
  241. */
  242. tapImg:function(ImgAr,index){
  243. uni.previewImage({
  244. current:index,
  245. urls:ImgAr
  246. });
  247. },
  248. /**
  249. * 拨打电话
  250. */
  251. tapTel:function(item){
  252. if(item.tel == null) {
  253. this.utils.showAlert({
  254. title:"系统提示",
  255. content:"暂无联系方式"
  256. });
  257. return;
  258. }
  259. const info = uni.getSystemInfoSync();
  260. if(info.platform == 'android'){
  261. uni.showModal({
  262. content: "确认拨打" + item.tel,
  263. confirmText: "确定",
  264. cancelText: "取消",
  265. success:function(res){
  266. if(res.confirm){
  267. this.$store.dispatch('permission/requestPermissions', 'CALL_PHONE').then(res => {
  268. if(res !== 1) return;
  269. uni.makePhoneCall({
  270. phoneNumber: item.tel,
  271. });
  272. });
  273. }
  274. }
  275. });
  276. } else {
  277. uni.makePhoneCall({
  278. phoneNumber: item.tel,
  279. });
  280. }
  281. },
  282. tapLbs:function(item){
  283. uni.openLocation({
  284. latitude: Number(item.lat),
  285. longitude: Number(item.lng),
  286. name: item.name,
  287. address: item.address,
  288. scale: 12,
  289. success: function() {
  290. console.log('success');
  291. },
  292. fail: function(res) {
  293. },
  294. })
  295. },
  296. },
  297. }
  298. </script>