chooseProductItemSkline.vue 4.6 KB

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