app-commodity.vue 4.4 KB

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