otherPartItem.vue 6.4 KB

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