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