chooseProductItemSkline.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191
  1. <template>
  2. <block>
  3. <view class="choose-product-item"
  4. v-for="(item, dix) in list"
  5. :key="item.id"
  6. >
  7. <view>
  8. <view class="choose-product-item-img">
  9. <!-- <text class="no-txt">{{index?(index*pageSize-(pageSize-fristLength))+(dix+1):(dix+1)}}</text> -->
  10. <image mode="aspectFit" :src="item.productImage+'?x-oss-process=image/resize,p_50'" style="width: 100%;height: 200rpx;"></image>
  11. <view class="back-price" v-if="item.promoRuleValue">返<text>{{item.promoRuleValue}}</text>元</view>
  12. <view class="choose-product-item-left-info-code ellipsis-one">{{item.productCode}}</view>
  13. </view>
  14. <view class="choose-product-item-info">
  15. <view class="choose-product-item-left-info-name ellipsis-two">{{item.productName}}</view>
  16. <view class="choose-product-item-left-info-guige ellipsis-two">{{item.productOrigCode}}</view>
  17. <view class="choose-product-item-left-info-price">
  18. <view class="price-txt">¥<text>{{item.cost}}</text></view>
  19. <view>
  20. <uni-number-box v-if="!edit" v-model="item.qty" :min="1" :max="999999" @change="v=>{changeQty(v,item.id)}"></uni-number-box>
  21. <view v-else class="edit-qty">
  22. X <text>{{item.qty}}</text>
  23. <image src="../static/del.png" style="width: 30px;height: 30px;" mode="aspectFit" @click="remove(item.id)"></image>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </block>
  31. </template>
  32. <script>
  33. import uniNumberBox from '@/components/uni-number-box/uni-number-box.vue'
  34. export default {
  35. name: 'chooseProductItemSkline',
  36. components: {
  37. uniNumberBox
  38. },
  39. props: {
  40. index: {
  41. type: Number,
  42. default: 0
  43. },
  44. list: {
  45. type: Array,
  46. default: () => []
  47. },
  48. edit: {
  49. type: Boolean,
  50. default: false
  51. },
  52. pageSize: {
  53. type: Number,
  54. default: 6
  55. },
  56. fristLength: {
  57. type: Number,
  58. default: 0
  59. }
  60. },
  61. data() {
  62. return {
  63. }
  64. },
  65. methods: {
  66. changeQty(e, id) {
  67. this.$emit('changeQty', e, id)
  68. },
  69. remove(id){
  70. this.$emit('remove',id)
  71. }
  72. }
  73. }
  74. </script>
  75. <style lang="less">
  76. .choose-product-item{
  77. display: flex;
  78. align-items: center;
  79. justify-content: space-between;
  80. padding: 10px;
  81. border-bottom: 1px solid #eee;
  82. .price-txt{
  83. color: red;
  84. display: flex;
  85. align-items: center;
  86. text{
  87. font-size: 36rpx;
  88. }
  89. }
  90. > view{
  91. display: flex;
  92. align-items: center;
  93. justify-content: space-between;
  94. flex-grow: 1;
  95. width: 100%;
  96. }
  97. .choose-product-item-img{
  98. margin-right: 20rpx;
  99. width: 35%;
  100. position: relative;
  101. overflow: hidden;
  102. border: 1px solid #eee;
  103. padding: 10rpx;
  104. .no-txt{
  105. position: absolute;
  106. top: 10rpx;
  107. left: 10rpx;
  108. height: 30rpx;
  109. min-width: 30rpx;
  110. background: #9E9E9E;
  111. color: #fff;
  112. text-align: center;
  113. line-height: 30rpx;
  114. border-radius: 5rpx;
  115. z-index: 100;
  116. }
  117. .back-price{
  118. zoom: calc(0.8);
  119. padding: 6rpx 65rpx;
  120. background: rgba(255 ,87 ,34 , 1);
  121. position: absolute;
  122. top: 18rpx;
  123. right: -45rpx;
  124. color: #fff;
  125. z-index: 2;
  126. font-size: 20rpx;
  127. text-align: center;
  128. transform: rotate(40deg);
  129. display: flex;
  130. align-items: center;
  131. text{
  132. font-size: 28rpx;
  133. margin: 0 5rpx;
  134. }
  135. }
  136. .choose-product-item-left-info-code{
  137. color: #666;
  138. position: absolute;
  139. width: 100%;
  140. left:0;
  141. bottom:0;
  142. background: rgba(255,255,255,0.7);
  143. text-align: center;
  144. }
  145. }
  146. .choose-product-item-info{
  147. margin-right: 10rpx;
  148. width: 65%;
  149. flex-grow: 1;
  150. .choose-product-item-left-info-price{
  151. display: flex;
  152. align-items:center;
  153. justify-content: space-between;
  154. >view{
  155. &:last-child{
  156. display: flex;
  157. align-items:center;
  158. }
  159. }
  160. .edit-qty{
  161. display: flex;
  162. align-items:center;
  163. justify-content: space-between;
  164. color: #999;
  165. font-size: 12px;
  166. > text{
  167. color: #666;
  168. font-size: 14px;
  169. }
  170. image{
  171. margin-left: 20px;
  172. }
  173. }
  174. }
  175. .choose-product-item-left-info-name{
  176. font-size: 28rpx;
  177. font-weight: 900;
  178. color: #666;
  179. }
  180. .choose-product-item-left-info-guige{
  181. color: #2196F3;
  182. margin: 10rpx 0;
  183. text{
  184. margin-right: 10rpx;
  185. }
  186. }
  187. }
  188. }
  189. </style>