chooseProductItemSkline.vue 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192
  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 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 v-if="!isView">
  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. isView: {
  53. type: Boolean,
  54. default: false
  55. }
  56. },
  57. data() {
  58. return {
  59. }
  60. },
  61. methods: {
  62. changeQty(e, id) {
  63. this.$emit('changeQty', e, id)
  64. },
  65. remove(id){
  66. this.$emit('remove',id)
  67. },
  68. toDetail(item){
  69. uni.navigateTo({
  70. url: '/pagesB/shopiing/productDetail?sn='+item.productSn
  71. })
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="less">
  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. flex-grow: 1;
  96. width: 100%;
  97. }
  98. .choose-product-item-img{
  99. margin-right: 20rpx;
  100. width: 30%;
  101. position: relative;
  102. overflow: hidden;
  103. border: 1px solid #eee;
  104. padding: 10rpx;
  105. .no-txt{
  106. position: absolute;
  107. top: 10rpx;
  108. left: 10rpx;
  109. height: 30rpx;
  110. min-width: 30rpx;
  111. background: #9E9E9E;
  112. color: #fff;
  113. text-align: center;
  114. line-height: 30rpx;
  115. border-radius: 5rpx;
  116. z-index: 100;
  117. }
  118. .back-price{
  119. zoom: calc(0.8);
  120. padding: 6rpx 65rpx;
  121. background: rgba(255 ,87 ,34 , 1);
  122. position: absolute;
  123. top: 18rpx;
  124. right: -45rpx;
  125. color: #fff;
  126. z-index: 2;
  127. font-size: 20rpx;
  128. text-align: center;
  129. transform: rotate(40deg);
  130. display: flex;
  131. align-items: center;
  132. text{
  133. font-size: 28rpx;
  134. margin: 0 5rpx;
  135. }
  136. }
  137. .choose-product-item-left-info-code{
  138. color: #666;
  139. position: absolute;
  140. width: 100%;
  141. left:0;
  142. bottom:0;
  143. background: rgba(255,255,255,0.7);
  144. text-align: center;
  145. }
  146. }
  147. .choose-product-item-info{
  148. margin-right: 10rpx;
  149. width: 70%;
  150. flex-grow: 1;
  151. .choose-product-item-left-info-price{
  152. display: flex;
  153. align-items:center;
  154. justify-content: space-between;
  155. >view{
  156. &:last-child{
  157. display: flex;
  158. align-items:center;
  159. }
  160. }
  161. .edit-qty{
  162. display: flex;
  163. align-items:center;
  164. justify-content: space-between;
  165. color: #999;
  166. font-size: 12px;
  167. > text{
  168. color: #666;
  169. font-size: 14px;
  170. }
  171. image{
  172. margin-left: 20px;
  173. }
  174. }
  175. }
  176. .choose-product-item-left-info-name{
  177. font-size: 28rpx;
  178. font-weight: 900;
  179. color: #666;
  180. }
  181. .choose-product-item-left-info-guige{
  182. color: #2196F3;
  183. margin: 10rpx 0;
  184. text{
  185. margin-right: 10rpx;
  186. }
  187. }
  188. }
  189. }
  190. </style>