vinPartItem.vue 7.2 KB

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