app-commodity.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244
  1. <template>
  2. <view class="item-cmd_bx" @click="showAddModelFn()">
  3. <view class="img_bx" style="background:#eeeeee">
  4. <image :src="info.cover" lazy-load="true" :lazy-load-margin="0"></image>
  5. <view style="width:30upx;height:30upx;top:0upx;left:0upx;position: absolute;" @click.stop="delProduct(info)"> </view>
  6. </view>
  7. <view class="cmd-info_bx">
  8. <view class="tit" >
  9. <text style="font-size:22upx;border:1upx solid #3385ff;color:white;background-color:#3385ff;margin-right:5upx;padding-left:5upx;padding-right:5upx;"
  10. v-if="info.frontHide && info.frontHide == 1">隐</text>
  11. <text style="font-size:22upx;border:1upx solid #3385ff;color:white;background-color:#3385ff;margin-right:5upx;padding-left:5upx;padding-right:5upx;"
  12. v-if="info.presell == 1">预售</text>
  13. {{ info.name || "" }}
  14. <text v-if="info.variety && info.variety ==1" class="show-color"></text>
  15. </view>
  16. <view class="kc" style="position:absolute;top:55upx;">
  17. <block v-if="info.ratioType == 0">{{info.ratio}}{{info.smallUnit}}/{{info.bigUnit}}</block>
  18. <block v-else>若干{{info.smallUnit}}/{{info.bigUnit}}</block>
  19. </view>
  20. <view class="kc num-open_bx flex-end">
  21. <view class="price" style="position:absolute;top:55upx;font-weight:bold;">
  22. ¥{{ parseFloat(info.price) }}
  23. <text v-if="info.reachNum && info.reachNum>0 && info.reachNumDiscount && info.reachNumDiscount>0" style="font-weight:normal;color:#3385FF;margin-left:20upx;">
  24. 满{{info.reachNum}}↓{{info.reachNumDiscount?parseFloat(info.reachNumDiscount):0}}
  25. </text>
  26. </view>
  27. <view style="text-align: right;margin-right:20upx;" >
  28. <view class="open-bx" >
  29. <i class="iconfont iconjian" @click.stop="reduceItemFn()" v-if="bigCount > 0 || smallCount > 0"></i>
  30. <text class="num" >
  31. <text style="font-weight:bold;color:#3385ff;" v-if="bigCount > 0">{{ `${bigCount}` }}</text>
  32. <text v-if="smallCount > 0">{{ `${smallCount}` }}</text>
  33. </text>
  34. <i class="iconfont iconzeng" @click.stop="addItemFn()"></i>
  35. </view>
  36. <text v-if="Number(info.stock) > Number(info.stockWarning)" style="color:#333;margin-right:65upx;">还剩 {{ parseFloat(info.stock) }}</text>
  37. <text v-else style="color:red;font-weight:bold;margin-right:65upx;">还剩 {{ parseFloat(info.stock) }}</text>
  38. </view>
  39. </view>
  40. </view>
  41. </view>
  42. </template>
  43. <script>
  44. export default {
  45. name: "Commodity",
  46. components: {},
  47. mixins: [],
  48. props: {
  49. info: {
  50. required: true,
  51. type: Object,
  52. default() {
  53. return {};
  54. }
  55. },
  56. scrollTop: {
  57. type: Number,
  58. default: 0
  59. },
  60. autoPrice: {},
  61. isActive: {
  62. type: Boolean,
  63. default: false
  64. },
  65. checkStock: {
  66. type: Boolean,
  67. default: false
  68. },
  69. isAlterPrice: {
  70. type: Boolean,
  71. default: false
  72. },
  73. selectJobType:{
  74. type: String,
  75. default: ''
  76. }
  77. },
  78. data() {
  79. return {
  80. ifFocus:false,
  81. bigCount:0,
  82. smallCount:0,
  83. userPrice:0
  84. };
  85. },
  86. watch:{
  87. info:{
  88. handler(newValue){
  89. this.bigCount = newValue.bigCount
  90. this.smallCount = newValue.smallCount
  91. this.userPrice = newValue.userPrice
  92. },
  93. deep:true
  94. }
  95. },
  96. created() {},
  97. computed: {
  98. },
  99. mounted() {
  100. this.bigCount = this.info.bigCount
  101. this.smallCount = this.info.smallCount
  102. this.userPrice = this.info.userPrice
  103. },
  104. methods: {
  105. delProduct(info){
  106. this.$emit("delProduct", info)
  107. },
  108. addItemFn () {
  109. if(this.info && this.info.variety == 1 && this.selectJobType == 'bill'){
  110. //小菊多颜色选择页
  111. this.$emit("goToSpecialVariety", this.info);
  112. return false
  113. }
  114. this.$emit("replaceItemFn", this.info,0,'add')
  115. },
  116. reduceItemFn() {
  117. if(this.info && this.info.variety == 1 && this.selectJobType == 'bill'){
  118. //小菊多颜色选择页
  119. this.$emit("goToSpecialVariety", this.info);
  120. return false
  121. }
  122. this.$emit("replaceItemFn", this.info,0,'sub')
  123. },
  124. showAddModelFn() {
  125. if(this.info && this.info.variety == 1 && this.selectJobType == 'bill'){
  126. //小菊多颜色选择页
  127. this.$emit("goToSpecialVariety", this.info);
  128. return false
  129. }
  130. this.$emit("showAddModelFn", { ...this.info, bigCount: this.bigCount, smallCount: this.smallCount, userPrice: this.userPrice})
  131. }
  132. }
  133. };
  134. </script>
  135. <style lang="scss" scoped>
  136. .item-cmd_bx {
  137. position: relative;
  138. margin-bottom: 20upx;
  139. .img_bx {
  140. height: 140upx;
  141. width: 140upx;
  142. position: absolute;
  143. left: 0upx;
  144. top: 0upx;
  145. image{
  146. width: 100%;
  147. height: 100%;
  148. }
  149. }
  150. .cmd-info_bx {
  151. padding-left: 160upx;
  152. padding-bottom: 30upx;
  153. & .tit {
  154. font-size: 32upx;
  155. font-weight: 700;
  156. color: #333333;
  157. overflow: hidden;
  158. white-space: nowrap;
  159. text-overflow: ellipsis;
  160. width:380upx;
  161. }
  162. .show-color{
  163. display:inline-block;
  164. width:25upx;
  165. height:25upx;
  166. background-color:rgb(9, 199, 9);
  167. border-radius:15upx;
  168. border:none;
  169. margin-left:16upx;
  170. }
  171. & .kc {
  172. position: relative;
  173. color: #999999;
  174. font-size: 24upx;
  175. .price{
  176. position: absolute;
  177. left: 0;
  178. bottom: 0;
  179. }
  180. }
  181. & .num-open_bx {
  182. display: flex;
  183. align-items: center;
  184. & .price {
  185. font-size: 28upx;
  186. color: #ff2842;
  187. flex: 1;
  188. }
  189. & .open-bx {
  190. display: flex;
  191. align-items: center;
  192. & .iconfont {
  193. color: #3385ff;
  194. font-size: 55upx;
  195. }
  196. .position{
  197. display: block;
  198. width: 70upx;
  199. text-align: center;
  200. }
  201. .iconcachu {
  202. margin: 0 6upx 0 20upx;
  203. color: #ccc;
  204. &.edit {
  205. color: #3385ff;
  206. }
  207. }
  208. & > .num {
  209. display: inline-block;
  210. width: 100upx;
  211. height:50upx;
  212. line-height:50upx;
  213. text-align:center;
  214. margin: 0 20upx;
  215. color: #868686;
  216. border-radius: 22upx;
  217. background-color: #f5f5f5;
  218. font-size: 28upx;
  219. }
  220. .change-input {
  221. width: 164upx;
  222. height: 60upx;
  223. line-height: 60upx;
  224. text-align: center;
  225. background: #ffffff;
  226. border: 1upx solid #dddddd;
  227. border-radius: 4upx;
  228. font-size: 25upx;
  229. }
  230. .btn-box{
  231. width: 100upx;
  232. height: 60upx;
  233. line-height: 60upx;
  234. color: #ffffff;
  235. background: #3385ff;
  236. text-align: center;
  237. border-radius: 10upx;
  238. }
  239. }
  240. }
  241. }
  242. }
  243. </style>