CommodityPurchase.vue 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="item-cmd_bx" @click="showAddModelFn">
  3. <view class="img_bx" style="background:#eeeeee"> <image :src="info.cover" lazy-load="true" :lazy-load-margin="0"></image> </view>
  4. <view class="cmd-info_bx">
  5. <view class="tit">
  6. <text style="font-size:22upx;border:1upx solid #3385ff;color:white;background-color:#3385ff;margin-right:5upx;padding-left:5upx;padding-right:5upx;"
  7. v-if="info.presell == 1">预售</text>
  8. {{ info.name || "" }}
  9. </view>
  10. <view class="num-open_bx">
  11. <view class="price" style="position:absolute;top:105upx;">¥{{ parseFloat(info.price) }}</view>
  12. <view style="position: relative;top:-14upx;">
  13. <view class="kc">
  14. <block v-if="info.ratioType == 0">{{info.ratio}}{{ info.smallUnit }}/{{info.bigUnit}}</block>
  15. <block v-else>若干{{ info.smallUnit }}/{{info.bigUnit}}</block>
  16. </view>
  17. </view>
  18. <view>
  19. <view class="open-bx">
  20. <i class="iconfont iconjian" @click.stop="delItemFn" v-if="bigCount > 0 || smallCount > 0" ></i>
  21. <text class="num" @click.stop="showAddModelFn" >
  22. <text v-if="bigCount > 0 || smallCount > 0">{{ `${bigCount}` }}</text>
  23. <text v-if="smallCount > 0">/</text>
  24. <text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
  25. </text>
  26. <i class="iconfont iconzeng" @click.stop="showAddModelFn" ></i>
  27. </view>
  28. <view class="price">
  29. <text class="unit">还剩 {{ parseFloat(info.stock) }}</text>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. name: "Commodity",
  39. components: {},
  40. mixins: [],
  41. props: {
  42. info: {
  43. required: true,
  44. type: Object,
  45. default () {
  46. return {bigCount:0,smallCount:0,userPrice:0};
  47. }
  48. },
  49. type: {
  50. type: String,
  51. default: '01'
  52. }
  53. },
  54. data () {
  55. return {
  56. bigCount:0,
  57. smallCount:0,
  58. userPrice:0
  59. };
  60. },
  61. watch:{
  62. info:{
  63. handler(){
  64. this.bigCount = this.info.bigCount
  65. this.smallCount = this.info.smallCount
  66. this.userPrice = this.info.userPrice
  67. },
  68. deep:true
  69. }
  70. },
  71. created () { },
  72. mounted() {
  73. this.bigCount = this.info.bigCount
  74. this.smallCount = this.info.smallCount
  75. this.userPrice = this.info.userPrice
  76. },
  77. methods: {
  78. delItemFn () {
  79. this.info.bigCount = 0
  80. this.info.smallCount = 0
  81. this.$emit("replaceItemFn", this.info,1)
  82. },
  83. showAddModelFn () {
  84. this.$emit("showAddModelFn", { ...this.info, bigCount: this.bigCount, smallCount: this.smallCount, userPrice: this.userPrice })
  85. }
  86. }
  87. };
  88. </script>
  89. <style lang="scss" scoped>
  90. .item-cmd_bx {
  91. position: relative;
  92. margin-bottom: 20upx;
  93. .img_bx {
  94. height: 140upx;
  95. width: 140upx;
  96. position: absolute;
  97. left: 0upx;
  98. top: 0upx;
  99. image{
  100. width: 100%;
  101. height: 100%;
  102. }
  103. }
  104. .cmd-info_bx {
  105. padding-left: 167upx;
  106. margin-bottom: 40upx;
  107. & .tit {
  108. font-size: 32upx;
  109. font-weight: 700;
  110. color: #333333;
  111. padding-top: 10upx;
  112. overflow: hidden;
  113. white-space: nowrap;
  114. text-overflow: ellipsis;
  115. width:380upx;
  116. }
  117. & .kc {
  118. color: #837f7f;
  119. font-size: 23upx;
  120. padding: 10upx 0 0;
  121. position: absolute;
  122. width:150upx;
  123. text-align: left;
  124. left: 0;
  125. top:15upx;
  126. font-size:25upx;
  127. }
  128. & .num-open_bx {
  129. text-align: right;
  130. display: flex;
  131. justify-content: space-between;
  132. & .price {
  133. font-size: 29upx;
  134. color: black;
  135. -webkit-box-flex: 1;
  136. -webkit-flex: 1;
  137. flex: 1;
  138. margin-right:90upx;
  139. .unit {
  140. font-size: 22upx;
  141. }
  142. }
  143. & .open-bx {
  144. align-items: center;
  145. display: inline-flex;
  146. & .iconfont {
  147. color: #4db0e4;
  148. font-size: 55upx;
  149. }
  150. .icondelete {
  151. margin: 0 10upx 0 30upx;
  152. color: #ccc;
  153. &.edit {
  154. color: #4db0e4;
  155. }
  156. }
  157. & > .num {
  158. display: inline-block;
  159. width: 120upx;
  160. height:50upx;
  161. line-height:50upx;
  162. text-align: center;
  163. margin: 0 8upx;
  164. color: #868686;
  165. border-radius: 22upx;
  166. background-color: #f5f5f5;
  167. font-size: 33upx;
  168. }
  169. .change-input {
  170. width: 164upx;
  171. height: 60upx;
  172. line-height: 60upx;
  173. text-align: center;
  174. background: #ffffff;
  175. border: 1upx solid #dddddd;
  176. border-radius: 4upx;
  177. font-size: 28upx;
  178. }
  179. }
  180. }
  181. }
  182. }
  183. </style>