threeDetail.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375
  1. <template>
  2. <view class="content">
  3. <view class="carousel">
  4. <swiper indicator-dots :circular="true" duration="400">
  5. <swiper-item class="swiper-item" v-for="(item, index) in imgList" :key="index">
  6. <view class="image-wrapper">
  7. <image :src="item" class="loaded" mode="scaleToFill"></image>
  8. </view>
  9. </swiper-item>
  10. </swiper>
  11. </view>
  12. <view class="introduce-section">
  13. <view class="price-box">
  14. <text class="price-tip">¥</text>
  15. <text class="price">{{ goodInfo.price_after}}</text>
  16. <!-- <text class="m-price" v-if="goodsObjact.ot_price > goodsObjact.price">¥{{ goodsObjact.ot_price }}</text> -->
  17. </view>
  18. <text class="title">{{ goodInfo.goods_name }}</text>
  19. </view>
  20. <view class="c-list">
  21. <view class="c-row b-b">
  22. <text class="tit">店铺</text>
  23. <view class="con">
  24. <text class="selected-text">{{ goodInfo.shopname }}</text>
  25. </view>
  26. </view>
  27. </view>
  28. <view class="detail-desc">
  29. <view class="d-header"><text>商品详情</text></view>
  30. <image :src="item" mode="widthFix" v-for="item in content" style="width: 100%;"></image>
  31. </view>
  32. <view class="" style="height: 98rpx;">
  33. </view>
  34. <view class="page-bottom">
  35. <view class="action-btn-group">
  36. <view class="buy-now">
  37. <button type="primary" class=" action-btn no-border add-cart-btn" @click="getDDUrl">立即购买</button>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. import {
  45. getGoodDetail,
  46. getUrl
  47. } from '@/api/three.js'
  48. export default {
  49. data() {
  50. return {
  51. id: 0,
  52. goods_sign: '',
  53. imgList: [],
  54. goodInfo: {},
  55. content: []
  56. }
  57. },
  58. onLoad(opt) {
  59. this.id = opt.id
  60. this.goods_sign = opt.goods_sign
  61. this.getGoodDetail()
  62. },
  63. onShow() {
  64. },
  65. onReachBottom() {
  66. },
  67. onReady() {
  68. },
  69. methods: {
  70. goGS_app(url) {
  71. // plus.runtime.openURL('its://') 此方法(浏览器)不管安卓还是ios都可以直接唤起APP, 'its://' 表示要唤起APP所支持的schemeURL协议
  72. // plus.runtime.launchApplication( appInf, errorCB ); appInf:需要唤起的三方, errorCB:启动第三方程序操作失败的回调函数
  73. // 判断平台
  74. plus.runtime.openURL(url);
  75. },
  76. getDDUrl() {
  77. getUrl({
  78. goods_sign: this.goods_sign
  79. }).then(res => {
  80. this.goGS_app(res.data.data.alldata.schema_url)
  81. })
  82. },
  83. getGoodDetail() {
  84. let that = this
  85. getGoodDetail({
  86. goods_sign: that.goods_sign
  87. }).then(res => {
  88. let data = res.data.data
  89. if (data) {
  90. that.goodInfo = data
  91. that.imgList = data.picurls
  92. for (let i = 0; i < that.imgList.length; i++) {
  93. that.content.unshift(that.imgList[i]);
  94. }
  95. } else {
  96. that.$api.msg('当前商品已下架')
  97. uni.navigateBack()
  98. }
  99. })
  100. }
  101. }
  102. }
  103. </script>
  104. <style lang="scss" scoped>
  105. .carousel {
  106. /* #ifdef APP-PLUS */
  107. padding-top: var(--status-bar-height);
  108. /* #endif */
  109. height: 722rpx;
  110. position: relative;
  111. swiper {
  112. height: 100%;
  113. }
  114. .image-wrapper {
  115. width: 100%;
  116. height: 100%;
  117. }
  118. .swiper-item {
  119. display: flex;
  120. justify-content: center;
  121. align-content: center;
  122. // height: 750rpx;
  123. height: 710rpx;
  124. overflow: hidden;
  125. image {
  126. width: 100%;
  127. height: 100%;
  128. }
  129. }
  130. }
  131. /* 标题简介 */
  132. .introduce-section {
  133. background: #fff;
  134. padding: 20rpx 30rpx;
  135. .title {
  136. font-size: 32rpx;
  137. color: $font-color-dark;
  138. height: 50rpx;
  139. line-height: 50rpx;
  140. }
  141. .price-box {
  142. display: flex;
  143. align-items: baseline;
  144. height: 64rpx;
  145. padding: 10rpx 0;
  146. font-size: 26rpx;
  147. color: #FD3B39;
  148. }
  149. .price {
  150. font-size: $font-lg + 2rpx;
  151. }
  152. .m-price {
  153. margin: 0 12rpx;
  154. color: $font-color-light;
  155. text-decoration: line-through;
  156. }
  157. .pt {
  158. text-decoration: none;
  159. }
  160. .coupon-tip {
  161. align-items: center;
  162. padding: 4rpx 10rpx;
  163. background: $uni-color-primary;
  164. font-size: $font-sm;
  165. color: #fff;
  166. border-radius: 6rpx;
  167. line-height: 1;
  168. transform: translateY(-4rpx);
  169. }
  170. .bot-row {
  171. display: flex;
  172. align-items: center;
  173. height: 50rpx;
  174. font-size: $font-sm;
  175. color: $font-color-light;
  176. text {
  177. flex: 1;
  178. }
  179. }
  180. }
  181. /* 详情 */
  182. .detail-desc {
  183. background: #fff;
  184. margin-top: 16rpx;
  185. /deep/ img {
  186. max-width: 100% !important;
  187. display: inline !important;
  188. }
  189. /deep/ div {
  190. max-width: 100% !important;
  191. }
  192. .d-header {
  193. display: flex;
  194. justify-content: center;
  195. align-items: center;
  196. height: 80rpx;
  197. font-size: $font-base + 2rpx;
  198. color: $font-color-dark;
  199. position: relative;
  200. text {
  201. padding: 0 20rpx;
  202. background: #fff;
  203. position: relative;
  204. z-index: 1;
  205. }
  206. &:after {
  207. position: absolute;
  208. left: 50%;
  209. top: 50%;
  210. transform: translateX(-50%);
  211. width: 300rpx;
  212. height: 0;
  213. content: '';
  214. border-bottom: 1px solid #ccc;
  215. }
  216. }
  217. }
  218. .c-list {
  219. margin-top: 20rpx;
  220. font-size: $font-sm + 2rpx;
  221. color: $font-color-base;
  222. background: #fff;
  223. .c-row {
  224. display: flex;
  225. align-items: center;
  226. padding: 20rpx 30rpx;
  227. position: relative;
  228. }
  229. .tit {
  230. width: 140rpx;
  231. }
  232. .con {
  233. flex: 1;
  234. color: $font-color-dark;
  235. .selected-text {
  236. margin-right: 10rpx;
  237. .num {
  238. color: #FD3B39;
  239. }
  240. }
  241. }
  242. }
  243. /* 底部操作菜单 */
  244. .page-bottom {
  245. position: fixed;
  246. left: 0rpx;
  247. bottom: 0rpx;
  248. z-index: 95;
  249. display: flex;
  250. justify-content: center;
  251. align-items: center;
  252. width: 750rpx;
  253. height: 98rpx;
  254. background: rgba(255, 255, 255, 0.9);
  255. box-shadow: 0 0 20rpx 0 rgba(0, 0, 0, 0.5);
  256. // border-radius: 16rpx;
  257. .p-b-btn {
  258. display: flex;
  259. flex-direction: column;
  260. align-items: center;
  261. justify-content: center;
  262. font-size: $font-sm;
  263. color: $font-color-base;
  264. width: 100rpx;
  265. height: 98rpx;
  266. .iconfont {
  267. font-size: 40rpx;
  268. line-height: 48rpx;
  269. color: $font-color-light;
  270. }
  271. &.active,
  272. &.active .iconfont {
  273. color: $uni-color-primary;
  274. }
  275. .icon-fenxiang2 {
  276. font-size: 42rpx;
  277. transform: translateY(-2rpx);
  278. }
  279. .iconlikefill {
  280. font-size: 46rpx;
  281. }
  282. }
  283. .action-btn-group {
  284. display: flex;
  285. height: 98rpx;
  286. overflow: hidden;
  287. position: relative;
  288. .shoucang {
  289. width: 100rpx;
  290. height: 100rpx;
  291. background: #FFFFFF;
  292. flex-direction: column;
  293. justify-content: center;
  294. font-size: 20rpx;
  295. image {
  296. width: 36rpx;
  297. height: 35rpx;
  298. margin-bottom: 10rpx;
  299. }
  300. }
  301. .buy-now {
  302. flex-grow: 1;
  303. // width: 650rpx;
  304. width: 750rpx;
  305. display: flex;
  306. }
  307. .action-btn {
  308. flex-shrink: 0;
  309. flex-grow: 1;
  310. display: flex;
  311. align-items: center;
  312. justify-content: center;
  313. // width: 580rpx;
  314. flex-grow: 1;
  315. height: 100%;
  316. font-size: 34rpx;
  317. padding: 0;
  318. border-radius: 0;
  319. // background: transparent;
  320. background: #ffb238;
  321. &.buy-now-btn {
  322. background-color: #ffb238;
  323. }
  324. &.add-cart-btn {
  325. background: #FD3B39;
  326. }
  327. }
  328. }
  329. }
  330. </style>