productDetails.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. <template>
  2. <view class="page">
  3. <!-- v-if="pageStatus != 'platform'" -->
  4. <view v-if="!downOrGrounding">
  5. <view class="top-fail" v-if="commodityDetail.final_status != 'unreview'">
  6. <image
  7. src="../../static/mine/332.png"
  8. class="fail-icon"
  9. mode=""
  10. ></image>
  11. <text v-if="commodityDetail.final_status == 'refuse'"
  12. >涉及敏感文字,您发布的商品审核未通过</text
  13. >
  14. <text v-else-if="!downOrGrounding"
  15. >该商品已下架,如有需要请重新上架</text
  16. >
  17. </view>
  18. <view class="fail" v-if="commodityDetail.final_status == 'unreview'">
  19. <image
  20. src="../../static/mine/333.png"
  21. class="fail-icon"
  22. mode=""
  23. ></image>
  24. <text>商品还在审核中,请耐心等待</text>
  25. </view>
  26. </view>
  27. <image class="goods-img" :src="commodityDetail.image" mode=""></image>
  28. <view class="price" v-if="commodityDetail.discount_price">
  29. <text style="font-size: 20rpx">折扣价</text>
  30. <text style="font-size: 18rpx">¥</text>
  31. <text style="font-size: 36rpx; font-weight: 600">{{
  32. commodityDetail.discount_price.split(".")[0]
  33. }}</text
  34. >.
  35. <text style="font-size: 18rpx">{{
  36. commodityDetail.discount_price.split(".")[1]
  37. }}</text>
  38. <text
  39. style="
  40. font-size: 24rpx;
  41. color: #ccc;
  42. text-decoration-line: line-through;
  43. "
  44. >
  45. ¥{{ commodityDetail.price }}
  46. </text>
  47. </view>
  48. <view class="goods-title">
  49. {{ commodityDetail.name_cn }}
  50. </view>
  51. <view class="goods-detail"> 商品详情 </view>
  52. <view class="detail">
  53. <!-- -->
  54. <view v-html="commodityDetail.detail_cn"></view>
  55. <!-- <image
  56. class="detail-img"
  57. v-for="item in commodityDetail.images.split(',')"
  58. :src="item"
  59. mode=""
  60. ></image> -->
  61. </view>
  62. <view class="footer" v-if="!downOrGrounding">
  63. <!-- <button class="btn">编辑商品</button> -->
  64. <button class="btn" @click="groundingCommodity">上架商品</button>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. status: 2,
  73. goodsId: 0,
  74. pageStatus: "",
  75. commodityDetail: {},
  76. };
  77. },
  78. onLoad(options) {
  79. this.goodsId = options.goodsId;
  80. this.pageStatus = options.pageStatus;
  81. if (options.pageStatus == "platform") {
  82. this.getGoodsDetail();
  83. } else {
  84. this.getGoodsManageDetail();
  85. }
  86. },
  87. computed: {
  88. downOrGrounding() {
  89. if (this.commodityDetail.status == "down") {
  90. return false;
  91. } else {
  92. if (this.commodityDetail.merchant_goods == "down") {
  93. return false;
  94. } else {
  95. return true;
  96. }
  97. }
  98. },
  99. },
  100. methods: {
  101. //获取平台库商品详情
  102. getGoodsDetail() {
  103. uni.$u.http
  104. .get(`/api/goods/platform_goods_details/${this.goodsId}`)
  105. .then((res) => {
  106. this.commodityDetail = res;
  107. });
  108. },
  109. //获取商品管理商品详情
  110. getGoodsManageDetail() {
  111. uni.$u.http.get(`/api/goods/detail/${this.goodsId}`).then((res) => {
  112. this.commodityDetail = res;
  113. });
  114. },
  115. //上架商品
  116. groundingCommodity() {
  117. if (this.commodityDetail.status == "down") {
  118. uni.showToast({
  119. title: "商品已下架,无法上架",
  120. icon: "none",
  121. });
  122. return;
  123. }
  124. uni.$u.http
  125. .post(`/api/goods/elencazione`, {
  126. goods_id: this.commodityDetail.merchant_goods_id,
  127. })
  128. .then((res) => {
  129. if (this.pageStatus == "platform") {
  130. this.getGoodsDetail();
  131. } else {
  132. this.getGoodsManageDetail();
  133. }
  134. uni.showToast({
  135. title: "已上架",
  136. icon: "none",
  137. });
  138. });
  139. },
  140. },
  141. mounted() {
  142. uni.setNavigationBarTitle({
  143. title: "商品详情",
  144. });
  145. },
  146. };
  147. </script>
  148. <style lang="scss" scoped>
  149. .page {
  150. background-color: #fff;
  151. padding-bottom: 150rpx;
  152. .top-fail {
  153. height: 60rpx;
  154. background-color: #fff1ee;
  155. padding-left: 24rpx;
  156. display: flex;
  157. align-items: center;
  158. font-size: 24rpx;
  159. color: #333;
  160. .fail-icon {
  161. width: 32rpx;
  162. height: 32rpx;
  163. margin-right: 10rpx;
  164. }
  165. }
  166. .fail {
  167. height: 60rpx;
  168. background-color: #fff1d7;
  169. padding-left: 24rpx;
  170. display: flex;
  171. align-items: center;
  172. font-size: 24rpx;
  173. color: #333;
  174. .fail-icon {
  175. width: 32rpx;
  176. height: 32rpx;
  177. margin-right: 10rpx;
  178. }
  179. }
  180. .goods-img {
  181. width: 100%;
  182. height: 750rpx;
  183. }
  184. .price {
  185. color: #f83224;
  186. margin-top: 36rpx;
  187. padding-left: 40rpx;
  188. font-weight: 600;
  189. }
  190. .goods-title {
  191. padding: 0 40rpx;
  192. font-size: 32rpx;
  193. margin-top: 20rpx;
  194. }
  195. .goods-detail {
  196. font-size: 28rpx;
  197. margin-top: 84rpx;
  198. padding-left: 40rpx;
  199. }
  200. .detail {
  201. padding: 24rpx 20rpx;
  202. .detail-img {
  203. width: 100%;
  204. }
  205. }
  206. .footer {
  207. position: fixed;
  208. bottom: 0;
  209. width: 100%;
  210. padding-bottom: 84rpx;
  211. padding-top: 20rpx;
  212. background-color: #fff;
  213. .btn {
  214. border-radius: 52rpx;
  215. background-color: #f83224;
  216. color: #fff;
  217. border: none;
  218. padding: 0;
  219. margin: 0;
  220. width: 94%;
  221. font-size: 30rpx;
  222. margin: 0 auto;
  223. }
  224. }
  225. }
  226. </style>