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. @click="toDetail(item)"
  7. >
  8. <view>
  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>
  32. </block>
  33. </template>
  34. <script>
  35. export default {
  36. name: 'chooseProductItemSkline',
  37. props: {
  38. index: {
  39. type: Number,
  40. default: 0
  41. },
  42. list: {
  43. type: Array,
  44. default: () => []
  45. },
  46. edit: {
  47. type: Boolean,
  48. default: false
  49. },
  50. isView: {
  51. type: Boolean,
  52. default: false
  53. }
  54. },
  55. data() {
  56. return {
  57. }
  58. },
  59. methods: {
  60. changeQty(e, id) {
  61. this.$emit('changeQty', e, id)
  62. },
  63. remove(id){
  64. this.$emit('remove',id)
  65. },
  66. toDetail(item){
  67. uni.navigateTo({
  68. url: '/pagesB/shopiing/productDetail?sn='+item.productSn
  69. })
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="less">
  75. .choose-product-item{
  76. display: flex;
  77. align-items: center;
  78. justify-content: space-between;
  79. padding: 10px;
  80. border-bottom: 1px solid #eee;
  81. .price-txt{
  82. color: red;
  83. display: flex;
  84. align-items: center;
  85. text{
  86. font-size: 36rpx;
  87. }
  88. }
  89. > view{
  90. display: flex;
  91. align-items: center;
  92. justify-content: space-between;
  93. flex-grow: 1;
  94. width: 100%;
  95. }
  96. .choose-product-item-img{
  97. margin-right: 20rpx;
  98. width: 30%;
  99. height: 180rpx;
  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: 70%;
  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>