otherPartItem.vue 6.3 KB

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