Item.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. <template>
  2. <view class="product">
  3. <view class="item-cmd_bx">
  4. <view class="img_bx">
  5. <view v-if="info.status == 2" class="sold-out">
  6. <view class="sold-out-xj">已下架</view>
  7. </view>
  8. <image :src="info.cover" style="width:160upx;height:160upx;" lazy-load="true" :lazy-load-margin="0"></image>
  9. </view>
  10. <view class="cmd-info_bx" @click="pageTo({url: '/admin/item/detail',query: {id: info.id}})">
  11. <view class="tit">{{ info.itemName || "" }}</view>
  12. <view class="kc">¥{{ parseFloat(info.skPrice) }}</view>
  13. <view class="num-open_bx">
  14. <view>
  15. <view class="open-bx" >
  16. 还剩 <text style="margin-left:8upx;color:#333333;">{{ parseFloat(info.stock) }}</text>
  17. <view class="price-area">
  18. <input class="change-input" @click.stop @blur="savePrice"
  19. @focus="modifyPrice = ''" placeholder-style="color:#CCCCCC" v-model="modifyPrice" type="digit" placeholder="填价格" />
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. export default {
  30. name: "Commodity",
  31. components: {
  32. },
  33. props: {
  34. isPrice: {
  35. type: Boolean,
  36. default: true
  37. },
  38. isEdit: {
  39. type: Boolean,
  40. default: true
  41. },
  42. info: {
  43. required: true
  44. }
  45. },
  46. data() {
  47. return {
  48. modifyPrice:'',
  49. };
  50. },
  51. watch: {
  52. },
  53. mounted(){
  54. },
  55. methods: {
  56. savePrice() {
  57. this.$emit("savePrice",this.modifyPrice,this.info.id);
  58. },
  59. }
  60. };
  61. </script>
  62. <style lang="scss" scoped>
  63. .product{
  64. height:230upx;
  65. .level-price{
  66. color:#999999;
  67. text-align: right;
  68. font-size:22upx;
  69. }
  70. }
  71. .item-cmd_bx {
  72. height:160upx;
  73. position: relative;
  74. margin-bottom: 20upx;
  75. .img_bx {
  76. height: 160upx;
  77. width: 160upx;
  78. position: absolute;
  79. left: 0upx;
  80. top: 0upx;
  81. .sold-out{
  82. width:160upx;
  83. height:160upx;
  84. background-color:black;
  85. position:absolute;
  86. top:0;
  87. left:0;
  88. opacity: 0.6;
  89. color:white;
  90. text-align:center;
  91. .sold-out-xj{
  92. line-height:160upx;
  93. font-size:28upx;
  94. }
  95. }
  96. }
  97. .cmd-info_bx {
  98. position: relative;
  99. padding-left: 177upx;
  100. &.active{
  101. &:before{
  102. content: ' ';
  103. height: 22upx;
  104. width: 22upx;
  105. border-width: 2upx 2upx 0 0;
  106. border-color: #b2b2b2;
  107. border-style: solid;
  108. -webkit-transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
  109. transform: matrix(0.5, 0.5, -0.5, 0.5, 0, 0);
  110. position: absolute;
  111. top: 50%;
  112. margin-top: -12upx;
  113. right: 30upx;
  114. }
  115. }
  116. & .tit {
  117. font-size: 30upx;
  118. font-weight: bold;
  119. color: #333333;
  120. padding-top: 0upx;
  121. overflow: hidden;
  122. white-space: nowrap;
  123. text-overflow: ellipsis;
  124. width:360upx;
  125. }
  126. & .kc {
  127. color:red;
  128. font-size: 32upx;
  129. padding: 17upx 0 24upx;
  130. font-weight: 700;
  131. }
  132. & .num-open_bx {
  133. display: flex;
  134. align-items: center;
  135. & .price {
  136. font-size: 30upx;
  137. color: red;
  138. flex: 1;
  139. }
  140. & .open-bx {
  141. color:#999999;
  142. width:300upx;
  143. text{
  144. font-size: 24upx;
  145. }
  146. *.warn {
  147. color: $redColor;
  148. }
  149. .price-area{
  150. width:190upx;
  151. position: absolute;
  152. top:50upx;
  153. right:0upx;
  154. .change-input {
  155. width: 150upx;
  156. height: 60upx;
  157. line-height: 60upx;
  158. text-align: center;
  159. background: #ffffff;
  160. border: 1upx solid #b4b4b4;
  161. border-radius: 4upx;
  162. font-size: 25upx;
  163. color:#777777;
  164. display:inline-block;
  165. }
  166. .change-text{
  167. font-size:22upx;
  168. }
  169. }
  170. }
  171. }
  172. }
  173. }
  174. </style>