敢为人鲜小程序前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

196 lines
3.6 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
  1. <template>
  2. <view class="page">
  3. <!-- 导航栏 -->
  4. <navbar title="商品详情" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="swipe">
  6. <uv-swiper :list="productDetail.image
  7. && productDetail.image.split(',')" indicator height="520rpx"></uv-swiper>
  8. </view>
  9. <!-- 商品标题 -->
  10. <view class="info">
  11. <view class="title">
  12. {{ productDetail.title }}
  13. </view>
  14. </view>
  15. <!-- 服务 -->
  16. <view class="server">
  17. <view class="setver-main">
  18. <view class="title">服务</view>
  19. <view class="descript">
  20. 免费上门退·7天无理由退货·快递发货
  21. </view>
  22. </view>
  23. <view class="server-arraw">
  24. <uv-icon name="arrow-right"></uv-icon>
  25. </view>
  26. </view>
  27. <!-- 参数 -->
  28. <view class="params">
  29. <view class="params-main">
  30. <view class="title">参数</view>
  31. <view class="descript">
  32. 品牌适应人群
  33. </view>
  34. </view>
  35. <view class="server-arraw">
  36. <uv-icon name="arrow-right"></uv-icon>
  37. </view>
  38. </view>
  39. <!-- 商品详情 -->
  40. <view class="item-line">
  41. <view class="before"></view>
  42. <view class="label">商品详情</view>
  43. </view>
  44. <uv-parse :content="productDetail.details"></uv-parse>
  45. <!-- 分享和购买按钮 -->
  46. <submit @service="service" @submit="submit" :detail="productDetail" />
  47. </view>
  48. </template>
  49. <script>
  50. import submit from '../components/product/submit.vue'
  51. import submitUnitSelect from '../components/product/submitUnitSelect.vue'
  52. export default {
  53. components: {
  54. submit,
  55. submitUnitSelect
  56. },
  57. data() {
  58. return {
  59. productDetail: {
  60. image: '',
  61. details: '',
  62. },
  63. id: 0,
  64. }
  65. },
  66. onLoad(args) {
  67. this.id = args.id
  68. },
  69. onShow() {
  70. this.getRiceProductDetail()
  71. },
  72. methods: {
  73. // 分享商品
  74. share() {
  75. },
  76. // 立即下单
  77. submit() {
  78. this.$store.commit('setPayOrderProduct', [
  79. this.productDetail
  80. ])
  81. this.$utils.navigateTo('/pages_order/order/createOrder')
  82. },
  83. // 获取商品
  84. getRiceProductDetail() {
  85. this.$api('getRiceProductDetail', {
  86. id: this.id
  87. }, res => {
  88. if (res.code == 200) {
  89. res.result.num = 1
  90. this.productDetail = res.result
  91. }
  92. })
  93. },
  94. // 联系客服
  95. service() {
  96. console.log("联系客服")
  97. // this.$api('service', {
  98. // shopId: this.id,
  99. // num: 1,
  100. // }, res => {
  101. // if (res.code == 200) {
  102. // uni.showToast({
  103. // title: '加入购物车成功',
  104. // icon: 'none'
  105. // })
  106. // }
  107. // })
  108. },
  109. }
  110. }
  111. </script>
  112. <style scoped lang="scss">
  113. .page {
  114. .swipe {}
  115. // 商品标题
  116. .info {
  117. padding: 20rpx;
  118. background-color: #fff;
  119. .title {
  120. font-size: 36rpx;
  121. font-weight: 900;
  122. }
  123. }
  124. // 服务 & 参数
  125. .server,
  126. .params {
  127. background: white;
  128. display: flex;
  129. justify-content: space-between;
  130. flex-wrap: wrap;
  131. padding: 30rpx 20rpx;
  132. box-sizing: border-box;
  133. .setver-main,
  134. .params-main {
  135. display: flex;
  136. flex-wrap: wrap;
  137. width: 90%;
  138. font-size: 32rpx;
  139. .title {
  140. color: #7C7C7C;
  141. margin-right: 20rpx;
  142. }
  143. }
  144. .server-arraw {
  145. display: flex;
  146. justify-content: flex-end;
  147. text-align: right;
  148. }
  149. }
  150. // 商品详情
  151. .item-line {
  152. display: flex;
  153. background: white;
  154. padding: 0rpx 20rpx;
  155. box-sizing: border-box;
  156. font-size: 34rpx;
  157. padding: 30rpx 20rpx;
  158. }
  159. .item-line .before {
  160. content: "";
  161. width: 8rpx;
  162. height: 30rpx;
  163. background: $uni-color;
  164. border-radius: 4rpx;
  165. margin-right: 10rpx;
  166. margin-top: 15rpx;
  167. }
  168. .item-line .label {
  169. display: flex;
  170. align-items: center;
  171. width: 152rpx;
  172. height: 60rpx;
  173. }
  174. }
  175. </style>