app-commodity2.vue 7.5 KB

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