青蛙卖大米小程序2024-11-24
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.

166 lines
2.9 KiB

6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
6 months ago
  1. <template>
  2. <view class="page">
  3. <navbar
  4. bgColor="transparent"
  5. style="position: absolute;"
  6. leftClick @leftClick="$utils.navigateBack" />
  7. <view class="swipe">
  8. <uv-swiper
  9. :list="productDetail.image
  10. && productDetail.image.split(',')"
  11. indicator
  12. height="520rpx"></uv-swiper>
  13. </view>
  14. <view class="info">
  15. <view style="width: 440rpx;">
  16. <view class="title">
  17. {{ productDetail.title }}
  18. </view>
  19. <view class="desc">
  20. {{ productDetail.sku }}
  21. </view>
  22. </view>
  23. <view class="">
  24. <view class="price">
  25. 会员价<text>{{ productDetail.price }}</text>
  26. </view>
  27. <view class="oldPrice">
  28. 零售价<text>{{ productDetail.oldPrice }}</text>
  29. </view>
  30. </view>
  31. </view>
  32. <uv-parse :content="productDetail.details"></uv-parse>
  33. <!-- 分享和购买按钮 -->
  34. <submit
  35. @addCart="addCart"
  36. @submit="submit"
  37. />
  38. <!-- <submit
  39. @submit="$refs.submitUnitSelect.open()"
  40. @share="share"/> -->
  41. <!-- 选择规格 -->
  42. <!-- <submitUnitSelect
  43. :detail="productDetail"
  44. ref="submitUnitSelect"/> -->
  45. </view>
  46. </template>
  47. <script>
  48. import submit from '../components/product/submit.vue'
  49. import submitUnitSelect from '../components/product/submitUnitSelect.vue'
  50. export default {
  51. components : {
  52. submit,
  53. submitUnitSelect
  54. },
  55. data() {
  56. return {
  57. productDetail : {
  58. image : '',
  59. details : '',
  60. },
  61. id : 0,
  62. }
  63. },
  64. onLoad(args) {
  65. this.id = args.id
  66. },
  67. onShow() {
  68. this.getRiceProductDetail()
  69. },
  70. methods: {
  71. // 分享商品
  72. share(){
  73. },
  74. // 立即下单
  75. submit(){
  76. this.$store.commit('setPayOrderProduct', [
  77. this.productDetail
  78. ])
  79. this.$utils.navigateTo('/pages_order/order/createOrder')
  80. },
  81. // 获取商品
  82. getRiceProductDetail(){
  83. this.$api('getRiceProductDetail', {
  84. id : this.id
  85. }, res => {
  86. if(res.code == 200){
  87. res.result.num = 1
  88. this.productDetail = res.result
  89. }
  90. })
  91. },
  92. addCart(){
  93. this.$api('addCart', {
  94. productId : this.id,
  95. num : 1,
  96. }, res => {
  97. if(res.code == 200){
  98. uni.showToast({
  99. title: '加入购物车成功',
  100. icon: 'none'
  101. })
  102. }
  103. })
  104. },
  105. }
  106. }
  107. </script>
  108. <style scoped lang="scss">
  109. .page{
  110. .swipe{
  111. }
  112. .info{
  113. padding: 30rpx;
  114. background-color: #fff;
  115. display: flex;
  116. justify-content: space-between;
  117. .title{
  118. font-size: 34rpx;
  119. font-weight: 900;
  120. }
  121. .price{
  122. font-size: 34rpx;
  123. color: $uni-color;
  124. font-weight: 900;
  125. text-align: right;
  126. }
  127. .oldPrice{
  128. font-size: 26rpx;
  129. color: #999;
  130. text-align: right;
  131. text-decoration: line-through;
  132. margin-top: 14rpx;
  133. }
  134. .desc{
  135. font-size: 26rpx;
  136. color: #777;
  137. margin-top: 20rpx;
  138. }
  139. }
  140. .info-unit{
  141. margin-top: 20rpx;
  142. padding: 30rpx;
  143. background-color: #fff;
  144. /deep/ text{
  145. font-size: 26rpx;
  146. }
  147. /deep/ .text{
  148. color: #7C7C7C;
  149. margin-right: 20rpx;
  150. font-size: 26rpx;
  151. }
  152. }
  153. }
  154. </style>