productDetails.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="page">
  3. <view v-if="pageStatus != 'platform'">
  4. <view class="top-fail" v-if="status != 2">
  5. <image
  6. src="../../static/mine/332.png"
  7. class="fail-icon"
  8. mode=""
  9. ></image>
  10. <text v-if="status == 1">涉及敏感文字,您发布的商品审核未通过</text>
  11. <text v-if="status == 3">该商品已下架,如有需要请重新上架</text>
  12. </view>
  13. <view class="fail" v-else>
  14. <image
  15. src="../../static/mine/333.png"
  16. class="fail-icon"
  17. mode=""
  18. ></image>
  19. <text>商品还在审核中,请耐心等待</text>
  20. </view>
  21. </view>
  22. <image class="goods-img" :src="commodityDetail.image" mode=""></image>
  23. <view class="price" v-if="commodityDetail.discount_price">
  24. <text style="font-size: 20rpx">折扣价</text>
  25. <text style="font-size: 18rpx">¥</text>
  26. <text style="font-size: 36rpx; font-weight: 600">{{
  27. commodityDetail.discount_price.split(".")[0]
  28. }}</text
  29. >.
  30. <text style="font-size: 18rpx">{{
  31. commodityDetail.discount_price.split(".")[1]
  32. }}</text>
  33. </view>
  34. <view class="goods-title">
  35. {{ commodityDetail.name_cn }}
  36. </view>
  37. <view class="goods-detail"> 商品详情 </view>
  38. <view class="detail">
  39. <!-- v-for="item in commodityDetail.images.split(',')" -->
  40. <image class="detail-img" :src="commodityDetail.images" mode=""></image>
  41. </view>
  42. <view class="footer">
  43. <!-- <button class="btn">编辑商品</button> -->
  44. <button class="btn" @click="groundingCommodity">上架商品</button>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. export default {
  50. data() {
  51. return {
  52. status: 2,
  53. goodsId: 0,
  54. pageStatus: "",
  55. commodityDetail: {},
  56. };
  57. },
  58. onLoad(options) {
  59. this.goodsId = options.goodsId;
  60. this.pageStatus = options.pageStatus;
  61. if (options.pageStatus == "platform") {
  62. this.getGoodsDetail();
  63. }
  64. },
  65. methods: {
  66. getGoodsDetail() {
  67. uni.$u.http
  68. .get(`/api/goods/platform_goods_details/${this.goodsId}`)
  69. .then((res) => {
  70. this.commodityDetail = res;
  71. });
  72. },
  73. //上架商品
  74. groundingCommodity() {
  75. uni.$u.http
  76. .post(`/api/goods/elencazione`, { goods_id: this.commodityDetail.id })
  77. .then((res) => {
  78. console.log(res);
  79. });
  80. },
  81. },
  82. mounted() {
  83. uni.setNavigationBarTitle({
  84. title: "商品详情",
  85. });
  86. },
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .page {
  91. background-color: #fff;
  92. .top-fail {
  93. height: 60rpx;
  94. background-color: #fff1ee;
  95. padding-left: 24rpx;
  96. display: flex;
  97. align-items: center;
  98. font-size: 24rpx;
  99. color: #333;
  100. .fail-icon {
  101. width: 32rpx;
  102. height: 32rpx;
  103. margin-right: 10rpx;
  104. }
  105. }
  106. .fail {
  107. height: 60rpx;
  108. background-color: #fff1d7;
  109. padding-left: 24rpx;
  110. display: flex;
  111. align-items: center;
  112. font-size: 24rpx;
  113. color: #333;
  114. .fail-icon {
  115. width: 32rpx;
  116. height: 32rpx;
  117. margin-right: 10rpx;
  118. }
  119. }
  120. .goods-img {
  121. width: 100%;
  122. height: 750rpx;
  123. }
  124. .price {
  125. color: #f83224;
  126. margin-top: 36rpx;
  127. padding-left: 40rpx;
  128. font-weight: 600;
  129. }
  130. .goods-title {
  131. padding: 0 40rpx;
  132. font-size: 32rpx;
  133. margin-top: 20rpx;
  134. }
  135. .goods-detail {
  136. font-size: 28rpx;
  137. margin-top: 84rpx;
  138. padding-left: 40rpx;
  139. }
  140. .detail {
  141. padding: 24rpx 20rpx;
  142. .detail-img {
  143. width: 100%;
  144. }
  145. }
  146. .footer {
  147. position: fixed;
  148. bottom: 0;
  149. width: 100%;
  150. padding-bottom: 84rpx;
  151. padding-top: 20rpx;
  152. background-color: #fff;
  153. .btn {
  154. border-radius: 52rpx;
  155. background-color: #f83224;
  156. color: #fff;
  157. border: none;
  158. padding: 0;
  159. margin: 0;
  160. width: 94%;
  161. font-size: 30rpx;
  162. margin: 0 auto;
  163. }
  164. }
  165. }
  166. </style>