shish 3 lat temu
rodzic
commit
3b7f8c3201

+ 1 - 1
ghsApp/src/admin/item/components/item.vue

@@ -72,7 +72,7 @@ export default {
 			this.$util.pageTo({url: "/pagesStorehouse/stockWarn/detailed?id="+item.id+'&name='+item.name})
 		},
 		breakSingleItem(item) {
-			this.$msg("开发中")
+			this.$emit('breakSingleItem', item)
 		}
 	}
 };

+ 68 - 3
ghsApp/src/admin/item/list.vue

@@ -27,7 +27,7 @@
 							<view v-if="classItem.child && !$util.isEmpty(classItem.child)">
 								<template v-for="(productItem, productIndex) in classItem.child">
 									<view style="height:255upx" :id="`class_${classIndex}`" :key="productIndex">
-										<ItemStock v-if="classItem.isActive" :info="productItem" @moreAction="moreAction" @doPrintLabel="doPrintLabel" @cancelDiscountFn="cancelDiscountFn" @cancelPreSellFn="cancelPreSellFn">
+										<ItemStock v-if="classItem.isActive" :info="productItem" @moreAction="moreAction" @doPrintLabel="doPrintLabel" @cancelDiscountFn="cancelDiscountFn" @cancelPreSellFn="cancelPreSellFn" @breakSingleItem="breakSingleItem">
 										</ItemStock>
 									</view>
 								</template>
@@ -60,6 +60,17 @@
 		</template>
 		</modal-module>
 
+		<modal-module :show="breakShow" @click="breakConfirm" :maskClosable="true" title="拆散数量" padding="30rpx 30rpx" >
+		<template v-slot:content>
+			<div class="app-modal-input-wrap">
+			<div class="inp-list-line">
+				<div class="line-input">
+				<input type="number" ref="input" style="width:61.8%;text-align:center;" @blur="blur" :focus="breakFocus" v-model="breakNum" :adjust-position="false" class="inp-input" />
+				</div>
+			</div>
+			</div>
+		</template>
+		</modal-module>
 		<uni-popup ref="selectFlowerNumRef" background-color="#fff" type="center" :animation="false" class="class-popup-style">
 			<view style="display:flex;padding:20upx;height:auto;justify-content: space-between;align-items:center;flex-wrap:wrap;max-height:100vh;overflow:auto;">
 
@@ -82,6 +93,7 @@
 				<view style="width:100vw;margin-top:8upx;"><button @click="shareItem()">分享</button></view>
 				<view style="width:100vw;margin-top:8upx;"><button @click="getHdPosterFn()">分享海报(花店)</button></view>
 				<view style="width:100vw;margin-top:8upx;"><button @click="getSkPosterFn()">分享海报(个人)</button></view>
+				<view style="width:100vw;margin-top:8upx;"><button @click="breakMore()">拆散</button></view>
 				<view style="width:100vw;margin-top:30upx;"><button @click="closeRightShow()">取消</button></view>
 			</view>
 		</uni-popup>
@@ -108,7 +120,7 @@ import productMins from "@/mixins/product";
 import { mapGetters } from "vuex";
 import { getWeixinId } from "@/api/invite/index";
 import { print,cancelDiscountPrice,cancelPreSell } from '@/api/product';
-import { getHdPoster,getSkPoster } from '@/api/item'
+import { getHdPoster,getSkPoster,breakItem } from '@/api/item'
 import uniPopup from '@/uni_modules/uni-popup/components/uni-popup/uni-popup.vue';
 import ModalModule from "@/components/plugin/modal"
 export default {
@@ -135,7 +147,10 @@ export default {
 			printFocus:false,
 			warning:0,
 			currentInfo:{},
-			posterUrl:''
+			posterUrl:'',
+			breakNum:'',
+			breakFocus:false,
+			breakShow:false
 		};
 	},
 	computed:{
@@ -156,6 +171,56 @@ export default {
 		})
 	},
 	methods: {
+		breakSingleItem(item){
+			let that = this
+			this.breakNum = 1
+			that.$util.confirmModal({content:'确定拆1份?'},() => {
+				that.breakAction()
+			})
+		},
+		breakMore(){
+			this.closeRightShow()
+			this.breakShow = true
+			this.breakNum = null
+			setTimeout(x => {
+				this.$nextTick(() => this.setBreakFocus())
+			}, 200)
+		},
+		breakAction(){
+			let that = this
+			breakItem({breakNum:that.breakNum,id:that.currentInfo.id}).then(res=>{
+				if(res.code == 1){
+					that.breakShow = false
+					that.breakFocus = false
+					that.$msg(res.msg)
+				}
+			})
+		},
+		breakConfirm(val){
+			let that=this;
+			if (val.index == 0) {
+				that.breakShow = false
+				that.breakFocus = false
+				return false
+			}
+			if (this.breakNum == null) {
+				that.$msg('请填写数量')
+				that.breakFocus = true
+				return false
+			}
+			if (Number(this.breakNum) <= 0) {
+				that.$msg('数量不能小于1')
+				that.breakFocus = true
+				return false
+			}
+			that.$util.confirmModal({content:'确认拆'+that.breakNum+'份?'},() => {
+				that.breakAction()
+			})
+		},
+		setBreakFocus(){
+			this.breakFocus = true
+		},
+
 		cancelPreSellFn(item){
 			let that = this
 			this.$util.confirmModal({content:'确认取消预售?'},() => {