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

179 lines
3.2 KiB

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