otherPartItem.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236
  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="addPart(item)"
  43. v-if="!item.checked"
  44. >+</view>
  45. <view class="flex align_center qty-box" v-else>
  46. <view class="qty-btn" @click="changeQty(item.qty-1,item,1)" :class="(item.qty <= 0)?'qty-disabled':''">-</view>
  47. <view class="qty-num"><input type="number" @blur="e=>changeQty(Number(e.detail.value),item,0)" v-model="item.qty"/></view>
  48. <view class="qty-btn" @click="changeQty(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="addPart(item)" v-if="!item.checked" class="phtxt">我要急送</text>
  54. <view class="flex align_center qty-box" v-else>
  55. <view class="qty-btn" @click="changeQty(item.qty-1,item,1)" :class="(item.qty <= 0)?'qty-disabled':''">-</view>
  56. <view class="qty-num"><input type="number" @blur="e=>changeQty(Number(e.detail.value),item,0)" v-model="item.qty"/></view>
  57. <view class="qty-btn" @click="changeQty(item.qty+1,item,1)" :class="(item.qty >= 999999)?'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(item) {
  112. this.$emit('addPart', item, 'other')
  113. },
  114. changeQty(value,item,type) {
  115. const max = item.currentInven || 999999
  116. const v = value > max ? max : value
  117. if(value > max && type == 0){
  118. this.updateNums(value,item.productSn)
  119. this.$nextTick(()=>{
  120. this.updateNums(v,item.productSn)
  121. })
  122. }else{
  123. this.updateNums(v,item.productSn)
  124. }
  125. },
  126. updateNums(value, id) {
  127. this.$emit('updateNums', {
  128. value: value,
  129. index: id
  130. })
  131. },
  132. viewImg(item) {
  133. this.$emit('viewImg', item)
  134. }
  135. }
  136. }
  137. </script>
  138. <style lang="less" scoped>
  139. @import '/flex.css';
  140. .qty-box{
  141. display: flex;
  142. .qty-num{
  143. width: 25px;
  144. height: 22px;
  145. line-height: 22px;
  146. padding:0 3px;
  147. input{
  148. width: 100%;
  149. height: 100%;
  150. text-align: center;
  151. color: #333;
  152. }
  153. }
  154. }
  155. .qty-btn{
  156. display: flex;
  157. align-items: center;
  158. justify-content: center;
  159. width: 22px;
  160. height: 22px;
  161. border-radius: 50px;
  162. font-size: 18px;
  163. background-color: #066cff;
  164. color: #fff;
  165. &.qty-disabled{
  166. background-color: #c0c0c0;
  167. }
  168. }
  169. .nav-right-item {
  170. padding: 15upx 25upx;
  171. border-bottom: 2rpx solid #f5f5f5;
  172. .uni-col-2 {
  173. width: 50px;
  174. }
  175. .item-info {
  176. padding-left: 10upx;
  177. width: 80%;
  178. flex-grow: 1;
  179. .item-name {
  180. font-size: 30upx;
  181. color: #191919;
  182. display: flex;
  183. align-items: center;
  184. >image {
  185. width: 38rpx;
  186. height: 38rpx;
  187. margin-right: 10rpx;
  188. }
  189. >text {
  190. flex: 1;
  191. word-break: break-all;
  192. }
  193. }
  194. .item-detail {
  195. .item-detail-info {
  196. padding: 10upx 0 4upx;
  197. /deep/ .uni-tag {
  198. word-break: break-all;
  199. font-size: 28rpx;
  200. color: #0fab04eee;
  201. border: 0;
  202. padding: 0.2rem 0.3rem;
  203. }
  204. >view {
  205. padding-bottom: 10rpx;
  206. align-items: center;
  207. .item-detail-text {
  208. color: #999;
  209. .phtxt {
  210. color: #0485F6;
  211. font-size: 28upx;
  212. }
  213. .item-price {
  214. color: #FB1E1E;
  215. font-size: 28upx;
  216. }
  217. }
  218. }
  219. }
  220. }
  221. }
  222. }
  223. </style>