敢为人鲜小程序前端代码仓库
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.

297 lines
5.8 KiB

5 months ago
5 months ago
3 months ago
5 months ago
5 months ago
5 months ago
3 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
3 months ago
3 months ago
3 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
3 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 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
3 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="750rpx"></uv-swiper>
  8. </view>
  9. <!-- 商品标题 -->
  10. <view class="info">
  11. <view class="title">
  12. {{ productDetail.title }}
  13. </view>
  14. <view class="price">
  15. <view class="money">
  16. <text>{{ productDetail.price }}</text>
  17. <text class="unit">/元每件</text>
  18. </view>
  19. <view class="oldPrice">
  20. <text>{{ productDetail.oldPrice }}</text>
  21. <text class="unit">/</text>
  22. </view>
  23. </view>
  24. <view class="price">
  25. <view class="money">
  26. <text>{{ productDetail.goldPrice }}</text>
  27. <text class="unit">/元每件</text>
  28. </view>
  29. <view class="price-imgs">
  30. <image :src="configList.vip_money_one" mode="aspectFill"
  31. class="price-img"></image>
  32. </view>
  33. </view>
  34. <view class="price">
  35. <view class="money">
  36. <text>{{ productDetail.silverPrice }}</text>
  37. <text class="unit">/元每件</text>
  38. </view>
  39. <view class="price-imgs">
  40. <image :src="configList.vip_money_two" mode="aspectFill" class="price-img">
  41. </image>
  42. </view>
  43. </view>
  44. <view class="price">
  45. <view class="money">
  46. <text>{{ productDetail.diamondPrice }}</text>
  47. <text class="unit">/元每件</text>
  48. </view>
  49. <view class="price-imgs">
  50. <image :src="configList.vip_money_three" mode="aspectFill" class="price-img">
  51. </image>
  52. </view>
  53. </view>
  54. </view>
  55. <!-- 服务 -->
  56. <view class="server">
  57. <view class="setver-main">
  58. <view class="title">服务</view>
  59. <view class="descript">
  60. 免费上门退·7天无理由退货·快递发货
  61. </view>
  62. </view>
  63. <view class="server-arraw">
  64. <uv-icon name="arrow-right"></uv-icon>
  65. </view>
  66. </view>
  67. <!-- 参数 -->
  68. <view v-if="productDetail.sku" class="params">
  69. <view class="params-main">
  70. <view class="title">参数</view>
  71. <view class="descript">
  72. {{ productDetail.sku }}
  73. </view>
  74. </view>
  75. <view class="server-arraw">
  76. <uv-icon name="arrow-right"></uv-icon>
  77. </view>
  78. </view>
  79. <!-- 商品详情 -->
  80. <view class="item-line">
  81. <view class="before"></view>
  82. <view class="label">商品详情</view>
  83. </view>
  84. <uv-parse :content="productDetail.details"></uv-parse>
  85. <!-- 分享和购买按钮 -->
  86. <submit
  87. @service="service"
  88. @toSend="toSend"
  89. @submit="submit"
  90. @addCart="addCart"
  91. :detail="productDetail" />
  92. <!-- 联系客服 -->
  93. <customerServicePopup ref="customerServicePopup" />
  94. </view>
  95. </template>
  96. <script>
  97. import submit from '../components/product/submit.vue'
  98. import submitUnitSelect from '../components/product/submitUnitSelect.vue'
  99. import customerServicePopup from '@/components/config/customerServicePopup.vue'
  100. export default {
  101. components: {
  102. submit,
  103. submitUnitSelect,
  104. customerServicePopup
  105. },
  106. data() {
  107. return {
  108. productDetail: {
  109. image: '',
  110. details: '',
  111. },
  112. id: 0,
  113. }
  114. },
  115. onLoad(args) {
  116. this.id = args.id
  117. },
  118. onShow() {
  119. this.getRiceProductDetail()
  120. },
  121. methods: {
  122. // 分享商品
  123. share() {
  124. },
  125. // 加入购物车
  126. addCart(){
  127. this.$api('addCart', {
  128. shopId : this.id,
  129. num : 1,
  130. }, res => {
  131. if(res.code == 200){
  132. uni.showToast({
  133. title: '加入购物车成功',
  134. icon: 'none'
  135. })
  136. }
  137. })
  138. },
  139. // 立即下单
  140. submit() {
  141. this.$store.commit('setPayOrderProduct', [
  142. this.productDetail
  143. ])
  144. this.$utils.navigateTo('/pages_order/order/createOrder')
  145. },
  146. toSend(){
  147. this.$store.commit('setPayOrderProduct', [
  148. this.productDetail
  149. ])
  150. // this.$utils.navigateTo('/pages_order/order/receiveGift?id=1894006757315850241')
  151. this.$utils.navigateTo('/pages_order/order/createOrder?type=give')
  152. },
  153. // 获取商品
  154. getRiceProductDetail() {
  155. this.$api('getRiceProductDetail', {
  156. id: this.id
  157. }, res => {
  158. if (res.code == 200) {
  159. res.result.num = 1
  160. this.productDetail = res.result
  161. }
  162. })
  163. },
  164. // 联系客服
  165. service() {
  166. this.$refs.customerServicePopup.open()
  167. },
  168. }
  169. }
  170. </script>
  171. <style scoped lang="scss">
  172. .page {
  173. padding-bottom: 120rpx;
  174. .swipe {}
  175. // 商品标题
  176. .info {
  177. padding: 20rpx;
  178. background-color: #fff;
  179. display: flex;
  180. flex-direction: column;
  181. gap: 14rpx;
  182. .title {
  183. font-size: 36rpx;
  184. font-weight: 900;
  185. }
  186. }
  187. // 服务 & 参数
  188. .server,
  189. .params {
  190. background: white;
  191. display: flex;
  192. justify-content: space-between;
  193. flex-wrap: wrap;
  194. padding: 30rpx 20rpx;
  195. box-sizing: border-box;
  196. .setver-main,
  197. .params-main {
  198. display: flex;
  199. flex-wrap: wrap;
  200. width: 90%;
  201. font-size: 32rpx;
  202. .title {
  203. color: #7C7C7C;
  204. margin-right: 20rpx;
  205. }
  206. }
  207. .server-arraw {
  208. display: flex;
  209. justify-content: flex-end;
  210. text-align: right;
  211. }
  212. }
  213. // 价格
  214. .price {
  215. display: flex;
  216. align-items: center;
  217. color: #f40;
  218. font-size: 30rpx;
  219. align-items: flex-end;
  220. .money {
  221. font-size: 30rpx;
  222. .unit {
  223. font-size: 24rpx;
  224. }
  225. }
  226. .price-imgs {
  227. display: flex;
  228. flex-wrap: wrap;
  229. .price-img {
  230. width: 80rpx;
  231. height: 30rpx;
  232. margin-left: 10rpx;
  233. }
  234. }
  235. }
  236. .oldPrice{
  237. color: #999;
  238. font-size: 24rpx;
  239. text-decoration: line-through;
  240. }
  241. // 商品详情
  242. .item-line {
  243. display: flex;
  244. background: white;
  245. box-sizing: border-box;
  246. font-size: 34rpx;
  247. padding: 20rpx;
  248. }
  249. .item-line .before {
  250. content: "";
  251. width: 8rpx;
  252. height: 30rpx;
  253. background: $uni-color;
  254. border-radius: 4rpx;
  255. margin-right: 10rpx;
  256. margin-top: 15rpx;
  257. }
  258. .item-line .label {
  259. display: flex;
  260. align-items: center;
  261. width: 152rpx;
  262. height: 60rpx;
  263. }
  264. }
  265. </style>