chooseProductItemSkline.vue 4.5 KB

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