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