app-commodity2.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275
  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="parseFloat((Number(info.stock)+Number(info.onStock)).toFixed(2)) > 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. remark:''
  90. };
  91. },
  92. watch:{
  93. info:{
  94. handler(newValue){
  95. this.bigCount = newValue.bigCount
  96. this.smallCount = newValue.smallCount
  97. this.userPrice = newValue.userPrice
  98. this.remark = newValue.remark||''
  99. },
  100. deep:true
  101. }
  102. },
  103. created() {},
  104. computed: {
  105. },
  106. mounted() {
  107. this.bigCount = this.info.bigCount
  108. this.smallCount = this.info.smallCount
  109. this.userPrice = this.info.userPrice
  110. this.remark = this.info.remark||''
  111. },
  112. methods: {
  113. copyCreate(){
  114. this.pageTo({url: '/admin/item/copy?id='+this.info.id})
  115. },
  116. delProduct(info){
  117. this.$emit("delProduct", info)
  118. },
  119. addItemFn () {
  120. if(this.info && this.info.variety == 1 && this.selectJobType == 'bill'){
  121. //小菊多颜色选择页
  122. this.$emit("goToSpecialVariety", this.info);
  123. return false
  124. }
  125. this.$emit("replaceItemFn", this.info,0,'add')
  126. },
  127. reduceItemFn() {
  128. if(this.info && this.info.variety == 1 && this.selectJobType == 'bill'){
  129. //小菊多颜色选择页
  130. this.$emit("goToSpecialVariety", this.info);
  131. return false
  132. }
  133. this.$emit("replaceItemFn", this.info,0,'sub')
  134. },
  135. showAddModelFn() {
  136. if(this.info && this.info.variety == 1 && this.selectJobType == 'bill'){
  137. //小菊多颜色选择页
  138. this.$emit("goToSpecialVariety", this.info);
  139. return false
  140. }
  141. this.$emit("showAddModelFn", { ...this.info, bigCount: this.bigCount, smallCount: this.smallCount, userPrice: this.userPrice,remark:this.remark})
  142. }
  143. }
  144. };
  145. </script>
  146. <style lang="scss" scoped>
  147. .item-cmd_bx {
  148. position: relative;
  149. margin-bottom: 20upx;
  150. .img_bx {
  151. height: 140upx;
  152. width: 140upx;
  153. position: absolute;
  154. left: 0upx;
  155. top: 0upx;
  156. image{
  157. width: 100%;
  158. height: 100%;
  159. }
  160. .sold-out{
  161. z-index:10;
  162. width:140upx;
  163. height:140upx;
  164. background-color:black;
  165. position:absolute;
  166. top:0;
  167. left:0;
  168. opacity: 0.6;
  169. color:white;
  170. text-align:center;
  171. .sold-out-xj{
  172. line-height:160upx;
  173. font-size:28upx;
  174. }
  175. .hide{
  176. line-height:160upx;
  177. font-size:30upx;
  178. }
  179. }
  180. }
  181. .cmd-info_bx {
  182. padding-left: 160upx;
  183. padding-bottom: 30upx;
  184. & .tit {
  185. font-size: 32upx;
  186. font-weight: 700;
  187. color: #333333;
  188. overflow: hidden;
  189. white-space: nowrap;
  190. text-overflow: ellipsis;
  191. width:380upx;
  192. }
  193. .show-color{
  194. display:inline-block;
  195. width:25upx;
  196. height:25upx;
  197. background-color:rgb(9, 199, 9);
  198. border-radius:15upx;
  199. border:none;
  200. margin-left:16upx;
  201. }
  202. & .kc {
  203. position: relative;
  204. color: #999999;
  205. font-size: 24upx;
  206. .price{
  207. position: absolute;
  208. left: 0;
  209. bottom: 0;
  210. }
  211. }
  212. & .num-open_bx {
  213. display: flex;
  214. align-items: center;
  215. & .price {
  216. font-size: 28upx;
  217. color: #ff2842;
  218. flex: 1;
  219. }
  220. & .open-bx {
  221. display: flex;
  222. align-items: center;
  223. & .iconfont {
  224. color: #3385ff;
  225. font-size: 55upx;
  226. }
  227. .position{
  228. display: block;
  229. width: 70upx;
  230. text-align: center;
  231. }
  232. .iconcachu {
  233. margin: 0 6upx 0 20upx;
  234. color: #ccc;
  235. &.edit {
  236. color: #3385ff;
  237. }
  238. }
  239. & > .num {
  240. display: inline-block;
  241. width: 100upx;
  242. height:50upx;
  243. line-height:50upx;
  244. text-align:center;
  245. margin: 0 20upx;
  246. color: #868686;
  247. border-radius: 22upx;
  248. background-color: #f5f5f5;
  249. font-size: 28upx;
  250. }
  251. .change-input {
  252. width: 164upx;
  253. height: 60upx;
  254. line-height: 60upx;
  255. text-align: center;
  256. background: #ffffff;
  257. border: 1upx solid #dddddd;
  258. border-radius: 4upx;
  259. font-size: 25upx;
  260. }
  261. .btn-box{
  262. width: 100upx;
  263. height: 60upx;
  264. line-height: 60upx;
  265. color: #ffffff;
  266. background: #3385ff;
  267. text-align: center;
  268. border-radius: 10upx;
  269. }
  270. }
  271. }
  272. }
  273. }
  274. </style>