vinPartItem.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <template>
  2. <block>
  3. <view class="nav-right-item flex" v-for="item in list" :key="item.productSn">
  4. <view class="uni-col-2">
  5. <image
  6. :src="item.images ? item.images+'?x-oss-process=image/resize,m_fixed,h_60,w_60,color_ffffff' : '/static/def_imgs.png'"
  7. @click="viewImg(item)"
  8. style="width:100rpx;height:100rpx;border-radius: 30rpx;background-color: #EBEBEB;"
  9. >
  10. </image>
  11. </view>
  12. <view class="item-info uni-col-10">
  13. <view class="item-name">
  14. <text>{{item.name}}</text>
  15. </view>
  16. <view class="item-detail">
  17. <view class="item-detail-info">
  18. <view class="flex justify_between">
  19. <view class="flex align_center">
  20. <text class="item-detail-text flex_1">{{item.code}}</text>
  21. <uni-tag v-if="commonPartCode.includes(item.code)" size="small" style="margin-left: 5px;" text="通用" :circle="true" type="success"></uni-tag>
  22. </view>
  23. <text class="item-detail-text" style="width: 50%;text-align: right;" v-if="item.affiliation=='SHELF'">库存:{{item.currentInven?item.currentInven:0}} {{item.unit}}</text>
  24. </view>
  25. <view class="flex" v-if="item.productTypeSn=='543766811373752320'">
  26. <uni-tag :text="item.origCode" inverted :circle="true" type="success"></uni-tag>
  27. </view>
  28. <view class="flex justify_between">
  29. <view class="item-detail-text">
  30. <!-- 货架产品 -->
  31. <view class="flex align_center" @click="openPriceModal(item,1,showShelfDetial)" v-if="item.affiliation=='SHELF'">
  32. <view class="item-price" :style="{color:!item.price?'#666':''}" v-if="showCarPrice&&configPrice&&configPrice.shelf_price_show == '1'">{{item.price?'¥'+item.price:'暂无价格'}}</view>
  33. <view class="item-price" :style="{color:!item.cost?'#666':''}" v-if="showCostPrice&&configPrice&&configPrice.shelf_cost_show == '1'">{{item.cost?'¥'+item.cost:'暂无价格'}}</view>
  34. <uni-icons type="arrowright" color="#00aaff" size="12" v-if="priceShowVal&&showShelfDetial"></uni-icons>
  35. </view>
  36. <!-- 非货架 -->
  37. <view class="flex align_center" @click="openPriceModal(item,1,showNonShelfDetial)" v-else>
  38. <view class="item-price" :style="{color:!item.price?'#666':''}" v-if="showCarPrice&&configPrice&&configPrice.non_shelf_price_show == '1'">{{item.price?'¥'+item.price:'暂无价格'}}</view>
  39. <view class="item-price" :style="{color:!item.cost?'#666':''}" v-if="showCostPrice&&configPrice&&configPrice.non_shelf_cost_show == '1'">{{item.cost?'¥'+item.cost:'暂无价格'}}</view>
  40. <uni-icons type="arrowright" color="#00aaff" size="12" v-if="priceShowVal&&showNonShelfDetial"></uni-icons>
  41. </view>
  42. </view>
  43. <view class="item-detail-text" v-if="item.currentInven">
  44. <view
  45. class="qty-btn flex align_center justify_center"
  46. @click="e=>{addPart(e,item)}"
  47. v-if="!item.checked"
  48. >+</view>
  49. <view class="flex align_center qty-box" v-else>
  50. <view class="qty-btn" @click="e=>{changeQty(null,item.qty-1,item,1)}" :class="(item.qty <= 0)?'qty-disabled':''">-</view>
  51. <view class="qty-num" :style="{width:Number(item.qty).toString().length*8+8+'px'}"><input type="number" @blur="e=>changeQty(null,Number(e.detail.value),item,0)" :value="item.qty"/></view>
  52. <view class="qty-btn" @click="e=>{changeQty(e,item.qty+1,item,1)}" :class="(item.qty >= item.currentInven)?'qty-disabled':''">+</view>
  53. </view>
  54. </view>
  55. <view class="item-detail-text" v-if="item.affiliation=='NON_SHELF'||!item.currentInven">
  56. <text v-if="!item.checked" @click="e=>{addPart(e,item)}" class="phtxt">我要急送</text>
  57. <view class="flex align_center qty-box" v-else>
  58. <view class="qty-btn" @click="e=>{changeQty(null,item.qty-1,item,1)}" :class="(item.qty <= 0)?'qty-disabled':''">-</view>
  59. <view class="qty-num" :style="{width:Number(item.qty).toString().length*8+8+'px'}"><input type="number" @blur="e=>changeQty(null,Number(e.detail.value),item,0)" :value="item.qty"/></view>
  60. <view class="qty-btn" @click="e=>{changeQty(e,item.qty+1,item,1)}" :class="(item.qty >= 999)?'qty-disabled':''">+</view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </block>
  69. </template>
  70. <script>
  71. export default {
  72. props: {
  73. list: {
  74. type: Array,
  75. default: () => {
  76. return []
  77. }
  78. },
  79. commonPartCode: {
  80. type: Array,
  81. default: () => {
  82. return []
  83. }
  84. },
  85. configPrice: {
  86. type: Object,
  87. default: () => {
  88. return {}
  89. }
  90. },
  91. showCarPrice: {
  92. type: Boolean,
  93. default: false
  94. },
  95. showCostPrice: {
  96. type: Boolean,
  97. default: false
  98. },
  99. showShelfDetial: {
  100. type: Boolean,
  101. default: false
  102. },
  103. showNonShelfDetial: {
  104. type: Boolean,
  105. default: false
  106. },
  107. priceShowVal: {
  108. type: Boolean,
  109. default: false
  110. },
  111. },
  112. data() {
  113. return {
  114. }
  115. },
  116. methods: {
  117. openPriceModal(item, type, show) {
  118. this.$emit('openPrice', item, type, show)
  119. },
  120. addPart(e,item) {
  121. this.$emit('addPart', e, item, 'vin')
  122. },
  123. changeQty(event,value,item,type) {
  124. const max = item.currentInven || 999
  125. const v = value > max ? max : value
  126. if(value > max && type == 0){
  127. this.updateNums(event,value,item.productSn)
  128. this.$nextTick(()=>{
  129. this.updateNums(event,v,item.productSn)
  130. })
  131. }else{
  132. this.updateNums(value > max ? null : event,v,item.productSn)
  133. }
  134. },
  135. updateNums(event,value, id) {
  136. this.$emit('updateVinNums', {
  137. value: Number(value),
  138. index: id,
  139. event:event
  140. })
  141. },
  142. viewImg(item){
  143. if(item.images){
  144. this.$emit('viewImg',item)
  145. }
  146. }
  147. }
  148. }
  149. </script>
  150. <style lang="less" scoped>
  151. @import '/flex.css';
  152. .qty-box{
  153. display: flex;
  154. .qty-num{
  155. width: 25px;
  156. height: 22px;
  157. line-height: 22px;
  158. padding:0 3px;
  159. input{
  160. width: 100%;
  161. height: 100%;
  162. text-align: center;
  163. color: #333;
  164. }
  165. }
  166. }
  167. .qty-btn{
  168. display: flex;
  169. align-items: center;
  170. justify-content: center;
  171. width: 22px;
  172. height: 22px;
  173. border-radius: 50px;
  174. font-size: 18px;
  175. background-color: #066cff;
  176. color: #fff;
  177. &.qty-disabled{
  178. background-color: #c0c0c0;
  179. }
  180. }
  181. .nav-right-item{
  182. padding: 15upx 25upx;
  183. border-bottom: 2rpx solid #f5f5f5;
  184. .uni-col-2{
  185. width: 50px;
  186. }
  187. .item-info{
  188. padding-left: 10upx;
  189. width: 80%;
  190. flex-grow: 1;
  191. .item-name{
  192. font-size: 30upx;
  193. color: #191919;
  194. display: flex;
  195. align-items: center;
  196. >image{
  197. width: 38rpx;
  198. height: 38rpx;
  199. margin-right: 10rpx;
  200. }
  201. >text{
  202. flex: 1;
  203. word-break: break-all;
  204. }
  205. }
  206. .item-detail{
  207. .item-detail-info{
  208. padding: 10upx 0 4upx;
  209. /deep/ .uni-tag{
  210. word-break: break-all;
  211. font-size: 28rpx;
  212. color: #0fab04eee;
  213. border: 0;
  214. padding: 0.2rem 0.3rem;
  215. }
  216. > view{
  217. padding-bottom: 10rpx;
  218. align-items: center;
  219. .item-detail-text{
  220. color: #999;
  221. .phtxt{
  222. color: #0485F6;
  223. font-size: 28upx;
  224. }
  225. .item-price{
  226. color: #FB1E1E;
  227. font-size: 28upx;
  228. }
  229. }
  230. }
  231. }
  232. }
  233. }
  234. }
  235. </style>