chooseProductItemSkline.vue 4.9 KB

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