CommodityPurchase.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  1. <template>
  2. <view class="item-cmd_bx">
  3. <view class="img_bx">
  4. <app-img :src="info.cover" alt="商品图" mode="aspectFit" :height="160" />
  5. </view>
  6. <view class="cmd-info_bx">
  7. <view class="tit">
  8. {{ info.itemName || "" }}
  9. </view>
  10. <view class="kc">{{ info.rank }}级</view>
  11. <view class="num-open_bx">
  12. <view class="price">
  13. <text class="unit">¥</text><text>{{ info.price }}</text>
  14. </view>
  15. <view class="open-bx">
  16. <i class="iconfont iconjian" @click="delEvent" v-if="bigCount > 0 || smallCount > 0"></i>
  17. <text class="num" @click="customNum" v-if="bigCount > 0 || smallCount > 0">
  18. <text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
  19. <text v-if="smallCount > 0">/</text>
  20. <text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
  21. </text>
  22. <i class="iconfont iconzeng" @click="addEvent"></i>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import { COMMODITY_TYPE } from "@/utils/declare";
  30. import AppImg from "@/components/app-img";
  31. export default {
  32. name: "Commodity",
  33. components: {
  34. AppImg
  35. },
  36. props: {
  37. info: {
  38. required: true,
  39. type: Object,
  40. default() {
  41. return {};
  42. }
  43. },
  44. type: {
  45. type: String,
  46. default: COMMODITY_TYPE.COMMON
  47. },
  48. bigCount: {
  49. type: Number,
  50. default: 0
  51. },
  52. smallCount: {
  53. type: Number,
  54. default: 0
  55. },
  56. autoPrice: {
  57. type: Number,
  58. default: 0
  59. }
  60. },
  61. data() {
  62. return {
  63. COMMODITY_TYPE
  64. };
  65. },
  66. created() {},
  67. methods: {
  68. addEvent() {
  69. this.$emit("add", this.info);
  70. },
  71. delEvent() {
  72. this.$emit("del", this.info);
  73. },
  74. removeEvent() {
  75. this.$emit("remove", this.info);
  76. },
  77. changePriceEvent(event) {
  78. const {
  79. detail: { value }
  80. } = event;
  81. this.$emit("changePrice", this.info, value);
  82. },
  83. customNum() {
  84. this.$emit("customNum", {
  85. ...this.info,
  86. bigCount: this.bigCount,
  87. smallCount: this.smallCount
  88. });
  89. }
  90. }
  91. };
  92. </script>
  93. <style lang="scss" scoped>
  94. .item-cmd_bx {
  95. position: relative;
  96. margin-bottom: 20px;
  97. .img_bx {
  98. height: 160px;
  99. width: 160px;
  100. position: absolute;
  101. left: 0px;
  102. top: 0px;
  103. }
  104. .cmd-info_bx {
  105. padding-left: 177px;
  106. & .tit {
  107. font-size: 28px;
  108. font-weight: 400;
  109. color: #333333;
  110. padding-top: 10px;
  111. }
  112. & .kc {
  113. color: #999999;
  114. font-size: 24px;
  115. padding: 10px 0 24px;
  116. }
  117. & .num-open_bx {
  118. display: flex;
  119. align-items: center;
  120. & .price {
  121. flex: 1;
  122. font-size: 32upx;
  123. color: #333;
  124. .unit {
  125. font-size: 22upx;
  126. }
  127. }
  128. & .open-bx {
  129. display: flex;
  130. align-items: center;
  131. & .iconfont {
  132. color: #4db0e4;
  133. font-size: 42px;
  134. }
  135. .icondelete {
  136. margin: 0 10px 0 30px;
  137. color: #ccc;
  138. &.edit {
  139. color: #4db0e4;
  140. }
  141. }
  142. & > .num {
  143. display: inline-block;
  144. width: 120rpx;
  145. text-align:center;
  146. margin: 0 8px;
  147. color: #868686;
  148. border-radius: 22px;
  149. background-color: #f5f5f5;
  150. padding: 3px 0;
  151. font-size: 30rpx;
  152. }
  153. .change-input {
  154. width: 164px;
  155. height: 60px;
  156. line-height: 60px;
  157. text-align: center;
  158. background: #ffffff;
  159. border: 1px solid #dddddd;
  160. border-radius: 4px;
  161. font-size: 28px;
  162. }
  163. }
  164. }
  165. }
  166. }
  167. </style>