chooseProductItemSkline.vue 4.3 KB

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