goodsDetail.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <view class="container-goods">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="header">
  5. <shop-goods :goodsDetail="goodsDetail"></shop-goods>
  6. </view>
  7. <view class="mian">
  8. <view class="label">
  9. <text class="title">详情</text>
  10. </view>
  11. <view class="text">
  12. {{goodsDetail.details || '暂无详情'}}
  13. </view>
  14. <template v-for="item in goodsDetail.details_images">
  15. <image class="goods-banner" :src="item" mode="widthFix"></image>
  16. </template>
  17. </view>
  18. <view class="footer">
  19. <view class="btn" @click="callPhone">
  20. <view class="iconfont3">&#xe679;</view>
  21. 打电话
  22. </view>
  23. <view class="btn location" @click="jump">
  24. <view class="iconfont3">&#xe613;</view>
  25. 导航去
  26. </view>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import shopGoods from "@/components/shop-goods.vue";
  32. export default {
  33. components: {
  34. shopGoods
  35. },
  36. data() {
  37. return {
  38. config: {
  39. back: true,
  40. title: '商品详情',
  41. color: '#1a1a1a',
  42. backgroundColor: [1, "#fff"],
  43. statusBarFontColor: '#fff',
  44. leftSlot: true
  45. },
  46. goodsId: '',
  47. shopId: '',
  48. shopInfo: {},
  49. goodsDetail: {}
  50. }
  51. },
  52. onLoad(options) {
  53. if (options && options.goodsId && options.shopId) {
  54. this.goodsId = options.goodsId
  55. this.shopId = options.shopId
  56. this.getShopInfo(options.shopId)
  57. this.getGoodsInfo(options.goodsId)
  58. }
  59. },
  60. methods: {
  61. getGoodsInfo(goodsId) {
  62. this.$http.get(`/offline/goods/info/${goodsId}`).then(res => {
  63. if (res.code == 200 && res.data) {
  64. this.goodsDetail = res.data
  65. }
  66. })
  67. },
  68. // 获取店铺信息
  69. getShopInfo(shopId) {
  70. this.$http.get("/yxt/shop/info/" + shopId).then((res) => {
  71. // uni.stopPullDownRefresh();
  72. // this.loading = false;
  73. if (res.data && res.code == 200) {
  74. this.shopInfo = res.data;
  75. }
  76. });
  77. },
  78. callPhone() {
  79. if (!this.shopInfo.mobile) {
  80. return this.$mUtil.toast('暂无客服热线')
  81. }
  82. this.$mUtil.callup(this.shopInfo.mobile)
  83. },
  84. jump() {
  85. if (!this.shopInfo.tx_latitude || !this.shopInfo.tx_longitude) {
  86. return this.$mUtil.toast('暂无地址')
  87. }
  88. this.$mUtil.jumpLocation(this.shopInfo.tx_latitude, this.shopInfo.tx_longitude)
  89. },
  90. }
  91. }
  92. </script>
  93. <style lang="scss" scoped>
  94. .container-goods {
  95. .header {
  96. width: 720rpx;
  97. height: 216rpx;
  98. margin: 14rpx auto 3rpx;
  99. background: url('@/static/shop/goods-bg.png') no-repeat;
  100. background-size: 100% 100%;
  101. /deep/ .goods {
  102. border: none;
  103. padding: 39rpx 30rpx 0 45rpx;
  104. }
  105. }
  106. .mian {
  107. padding: 0 37rpx 200rpx 30rpx;
  108. .label {
  109. text-align: center;
  110. font-size: 32rpx;
  111. font-family: PingFang SC, PingFang SC-Bold;
  112. font-weight: 700;
  113. color: #333333;
  114. margin-bottom: 25rpx;
  115. .title {
  116. position: relative;
  117. padding: 2rpx 0 10rpx;
  118. &::after {
  119. display: block;
  120. content: '';
  121. position: absolute;
  122. left: 0;
  123. bottom: 0;
  124. width: 100%;
  125. height: 4rpx;
  126. background: #FA6138;
  127. border-radius: 2rpx;
  128. }
  129. }
  130. }
  131. .text {
  132. text-align: justify;
  133. margin-bottom: 25rpx;
  134. }
  135. .goods-banner {
  136. width: 100%;
  137. vertical-align: middle;
  138. }
  139. }
  140. .footer {
  141. position: fixed;
  142. bottom: 0;
  143. display: flex;
  144. width: 100%;
  145. padding: 30rpx 60rpx;
  146. justify-content: space-around;
  147. background-color: #fff;
  148. .btn {
  149. display: flex;
  150. align-items: center;
  151. justify-content: center;
  152. width: 298rpx;
  153. height: 85rpx;
  154. background: #ff6600;
  155. border-radius: 43rpx;
  156. font-size: 28rpx;
  157. font-family: PingFang SC, PingFang SC-Regular;
  158. font-weight: 400;
  159. color: #ffffff;
  160. view {
  161. margin-right: 8rpx;
  162. font-size: 36rpx;
  163. }
  164. }
  165. .location {
  166. background: #FA6138;
  167. }
  168. }
  169. }
  170. </style>