app-commodity2.vue 6.6 KB

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