chooseProductItemSkline.vue 4.8 KB

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