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: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="addPart(item)"
  47. v-if="!item.checked"
  48. >+</view>
  49. <view class="flex align_center qty-box" v-else>
  50. <view class="qty-btn" @click="changeQty(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(Number(e.detail.value),item,0)" :value="item.qty"/></view>
  52. <view class="qty-btn" @click="changeQty(item.qty+1,item,1)" :class="(item.qty >= item.currentInven)?'qty-disabled':''">+</view>
  53. </view>
  54. <!-- <uni-number-box v-else :hideInput="true" @change="e=>updateVinNums(e,item.productSn)" v-model="item.qty" :min="0" :max="item.currentInven"></uni-number-box> -->
  55. </view>
  56. <view class="item-detail-text" v-if="item.affiliation=='NON_SHELF'||!item.currentInven">
  57. <text v-if="!item.checked" @click="addPart(item)" class="phtxt">我要急送</text>
  58. <view class="flex align_center qty-box" v-else>
  59. <view class="qty-btn" @click="changeQty(item.qty-1,item,1)" :class="(item.qty <= 0)?'qty-disabled':''">-</view>
  60. <view class="qty-num" :style="{width:Number(item.qty).toString().length*8+8+'px'}"><input type="number" @blur="e=>changeQty(Number(e.detail.value),item,0)" :value="item.qty"/></view>
  61. <view class="qty-btn" @click="changeQty(item.qty+1,item,1)" :class="(item.qty >= 999)?'qty-disabled':''">+</view>
  62. </view>
  63. <!-- <uni-number-box v-else :hideInput="true" @change="e=>updateVinNums(e,item.productSn)" v-model="item.qty" :min="0"></uni-number-box> -->
  64. </view>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </view>
  70. </block>
  71. </template>
  72. <script>
  73. export default {
  74. props: {
  75. list: {
  76. type: Array,
  77. default: () => {
  78. return []
  79. }
  80. },
  81. commonPartCode: {
  82. type: Array,
  83. default: () => {
  84. return []
  85. }
  86. },
  87. configPrice: {
  88. type: Object,
  89. default: () => {
  90. return {}
  91. }
  92. },
  93. showCarPrice: {
  94. type: Boolean,
  95. default: false
  96. },
  97. showCostPrice: {
  98. type: Boolean,
  99. default: false
  100. },
  101. showShelfDetial: {
  102. type: Boolean,
  103. default: false
  104. },
  105. showNonShelfDetial: {
  106. type: Boolean,
  107. default: false
  108. },
  109. priceShowVal: {
  110. type: Boolean,
  111. default: false
  112. },
  113. },
  114. data() {
  115. return {
  116. }
  117. },
  118. methods: {
  119. openPriceModal(item, type, show) {
  120. this.$emit('openPrice', item, type, show)
  121. },
  122. addPart(item) {
  123. this.$emit('addPart', item, 'vin')
  124. },
  125. changeQty(value,item,type) {
  126. const max = item.currentInven || 999
  127. const v = value > max ? max : value
  128. if(value > max && type == 0){
  129. this.updateNums(value,item.productSn)
  130. this.$nextTick(()=>{
  131. this.updateNums(v,item.productSn)
  132. })
  133. }else{
  134. this.updateNums(v,item.productSn)
  135. }
  136. },
  137. updateNums(value, id) {
  138. this.$emit('updateVinNums', {
  139. value: Number(value),
  140. index: id
  141. })
  142. },
  143. viewImg(item){
  144. if(item.images){
  145. this.$emit('viewImg',item)
  146. }
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="less" scoped>
  152. @import '/flex.css';
  153. .qty-box{
  154. display: flex;
  155. .qty-num{
  156. width: 25px;
  157. height: 22px;
  158. line-height: 22px;
  159. padding:0 3px;
  160. input{
  161. width: 100%;
  162. height: 100%;
  163. text-align: center;
  164. color: #333;
  165. }
  166. }
  167. }
  168. .qty-btn{
  169. display: flex;
  170. align-items: center;
  171. justify-content: center;
  172. width: 22px;
  173. height: 22px;
  174. border-radius: 50px;
  175. font-size: 18px;
  176. background-color: #066cff;
  177. color: #fff;
  178. &.qty-disabled{
  179. background-color: #c0c0c0;
  180. }
  181. }
  182. .nav-right-item{
  183. padding: 15upx 25upx;
  184. border-bottom: 2rpx solid #f5f5f5;
  185. .uni-col-2{
  186. width: 50px;
  187. }
  188. .item-info{
  189. padding-left: 10upx;
  190. width: 80%;
  191. flex-grow: 1;
  192. .item-name{
  193. font-size: 30upx;
  194. color: #191919;
  195. display: flex;
  196. align-items: center;
  197. >image{
  198. width: 38rpx;
  199. height: 38rpx;
  200. margin-right: 10rpx;
  201. }
  202. >text{
  203. flex: 1;
  204. word-break: break-all;
  205. }
  206. }
  207. .item-detail{
  208. .item-detail-info{
  209. padding: 10upx 0 4upx;
  210. /deep/ .uni-tag{
  211. word-break: break-all;
  212. font-size: 28rpx;
  213. color: #0fab04eee;
  214. border: 0;
  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>