Kaynağa Gözat

改库存与采购--添加取消限购 / 取消满减 / 取消特价

shizhongqi 2 ay önce
ebeveyn
işleme
e92bceeb73

+ 22 - 2
ghsApp/src/admin/changePrice/changeStock2.vue

@@ -30,7 +30,7 @@
 								<view class="item_list_title" v-if="productItem.className && productItem.className!=''">{{ productItem.className }}</view>
 								<view style="height:190upx" :key="productIndex">
 									<ItemComponent :isPrice="false" :info="productItem" @saveStock="saveStock" :ref="`productRef${productItem.id}`" 
-									@hideChangeFn="hideChangeFn" @cancelPreSellFn="cancelPreSellFn" @cancelLimitBuyFn="cancelLimitBuyFn">
+									@hideChangeFn="hideChangeFn" @cancelPreSellFn="cancelPreSellFn" @cancelLimitBuyFn="cancelLimitBuyFn" @cancelFullOff="cancelFullOff" @cancelDiscountFn="cancelDiscountFn">
 								</ItemComponent>
 								</view>
 							</template>
@@ -78,7 +78,7 @@ import productMins from "@/mixins/product2";
 import { mapGetters } from "vuex";
 import { checkOrderApi } from "@/api/inventory";
 import { changeFrontHide, cancelLimitBuy } from "@/api/item";
-import { cancelPreSell } from '@/api/product'
+import { cancelPreSell, cancelFullOffFn, cancelDiscountPrice } from '@/api/product'
 export default {
 	name: "item_list",
 	components: {
@@ -129,6 +129,26 @@ export default {
 				})
 			})
 		},
+		cancelFullOff(item){
+			let that = this
+			this.$util.confirmModal({content:'确认取消满减?'},() => {
+				cancelFullOffFn({id:item.id}).then(res=>{
+					if(res.code == 1){
+						that.$msg(res.msg)
+					}
+				})
+			})
+		},
+		cancelDiscountFn(item){
+			let that = this
+			this.$util.confirmModal({content:'确认取消特价?'},() => {
+				cancelDiscountPrice({id:item.id}).then(res=>{
+					if(res.code == 1){
+						that.$msg(res.msg)
+					}
+				})
+			})
+		},
 		hideChangeFn(item,status){
 			let that = this
 			changeFrontHide({id:item.id,status:status}).then(res=>{

+ 22 - 0
ghsApp/src/admin/changePrice/components/changeStockItem2.vue

@@ -3,6 +3,8 @@
 	<view class="item-cmd_bx">
 		<view class="img_bx" @click="pageTo({url: '/admin/item/detail?id='+info.id})">
 			<button v-if="Number(info.limitBuy) > 0" @click.stop="cancelLimitBuyFn(info)" class="admin-button-com mini-btn blue cancel-limit-buy-btn">取消限购</button>
+			<button v-if="Number(info.discountPrice)>0" @click.stop="cancelDiscountFn(info)" class="admin-button-com mini-btn blue cancel-discount-btn">取消特价</button>
+			<button v-if="info.reachNum && Number(info.reachNum)>0 && info.reachNumDiscount && Number(info.reachNumDiscount)>0" @click.stop="cancelFullOff(info)" class="admin-button-com mini-btn blue cancel-full-off-btn">取消满减</button>
 			<block v-if="info.status == 2">
 				<view class="sold-out">
 					<view class="sold-out-xj">已下架</view>
@@ -79,6 +81,12 @@ export default {
 		cancelLimitBuyFn(item){
 			this.$emit("cancelLimitBuyFn", item)
 		},
+		cancelDiscountFn(item){
+			this.$emit("cancelDiscountFn", item)
+		},
+		cancelFullOff(item){
+			this.$emit("cancelFullOff", item)
+		},
 		saveStock() {
 			if(Number(this.modifyStock)>=0){
 				this.$emit("saveStock",this.modifyStock,this.info.id)
@@ -118,6 +126,20 @@ export default {
 			background-color:#ff4d4f;
 			border-color:#ff4d4f;
 		}
+		.cancel-discount-btn{
+			position:absolute;
+			bottom:0;
+			left:10upx;
+			z-index:45;
+			font-size:24upx;
+		}
+		.cancel-full-off-btn{
+			position:absolute;
+			bottom:0;
+			left:10upx;
+			z-index:50;
+			font-size:24upx;
+		}
 		.sold-out{
 			z-index:10;
 			width:160upx;

+ 121 - 16
ghsApp/src/pagesPurchase/components/pageSuccess.vue

@@ -40,18 +40,35 @@
 											<text style="color:green;margin-left:9upx;font-weight:normal;">...</text>
 										</text>
 									</view>
-									<view
-										class="price-input-row"
-										:class="{'has-cancel-limit': Number(res.limitBuy) > 0}"
-									>
+									<view class="price-input-row">
 										<input type="digit" v-model="res.suggestHjPrice" @focus="clearHjPrice(i)" placeholder="大客价" class="price-input" />
 										<input type="digit" v-model="res.suggestPrice" @focus="clearPrice(i)" @input="linkChange(i)" placeholder="批发价" class="price-input price-input-main" />
 										<input type="digit" v-model="res.suggestSkPrice" @focus="clearSkPrice(i)" placeholder="零售价" class="price-input" />
+									</view>
+									<view class="cancel-action-row" v-if="hasCancelAction(res)">
 										<view
 											v-if="Number(res.limitBuy) > 0"
 											class="cancel-limit-btn"
 											@click.stop="cancelLimitBuyFn(i)"
 										>取消限购</view>
+										<view
+											v-if="hasFullOff(res)"
+											class="cancel-action-btn"
+											@click.stop="cancelFullOff(i)"
+										>取消满减</view>
+										<text
+											v-if="hasFullOff(res)"
+											class="action-tip full-off-tip"
+										>满{{ res.reachNum }}↓{{ res.reachNumDiscount ? parseFloat(res.reachNumDiscount) : 0 }}</text>
+										<view
+											v-if="Number(res.discountPrice) > 0"
+											class="cancel-action-btn"
+											@click.stop="cancelDiscountFn(i)"
+										>取消特价</view>
+										<text
+											v-if="Number(res.discountPrice) > 0"
+											class="action-tip discount-tip"
+										>特价{{ res.discountPrice ? parseFloat(res.discountPrice) : 0 }}</text>
 										<text
 											v-if="Number(res.limitBuy) > 0"
 											class="limit-buy-tip"
@@ -92,7 +109,7 @@
 	</view>
 </template>
 <script>
-import { getAllProductDataApi,batchChangePrice } from "@/api/product";
+import { getAllProductDataApi,batchChangePrice,cancelDiscountPrice,cancelFullOffFn } from "@/api/product";
 import { getCgItemList,getPurchaseDetailApi,confirmPutIn,saveCgPrice } from "@/api/purchase";
 import { cancelLimitBuy, clearItemRemark } from "@/api/item";
 import { IMGHOST } from '@/config'
@@ -119,6 +136,12 @@ export default {
 		}
 	},
 	methods: {
+		hasFullOff(item) {
+			return item && Number(item.reachNum) > 0 && Number(item.reachNumDiscount) > 0
+		},
+		hasCancelAction(item) {
+			return Number(item.limitBuy) > 0 || Number(item.discountPrice) > 0 || this.hasFullOff(item)
+		},
 		linkChange(i){
 			if(this.flowersList[i].suggestPrice && Number(this.flowersList[i].suggestPrice)>0){
 				let skMore = this.flowersList[i].skMore ? Number(this.flowersList[i].skMore) : 0
@@ -287,6 +310,63 @@ export default {
 				})
 			})
 		},
+		cancelFullOff(index){
+			const item = this.flowersList[index]
+			if (!this.hasFullOff(item)) {
+				return
+			}
+			const productId = item.productId
+			if (!productId) {
+				this.$msg('花材信息缺失')
+				return
+			}
+			this.$util.confirmModal({ content: '确认取消满减?' }, () => {
+				let pendingMsg = ''
+				uni.showLoading({ mask: true })
+				cancelFullOffFn({ id: productId }).then(res => {
+					if (res.code == 1) {
+						this.$set(this.flowersList[index], 'reachNum', 0)
+						this.$set(this.flowersList[index], 'reachNumDiscount', 0)
+						pendingMsg = res.msg || '取消成功'
+					}
+				}).finally(() => {
+					uni.hideLoading()
+					if (pendingMsg) {
+						setTimeout(() => {
+							this.$msg(pendingMsg)
+						}, 100)
+					}
+				})
+			})
+		},
+		cancelDiscountFn(index){
+			const item = this.flowersList[index]
+			if (!item || Number(item.discountPrice) <= 0) {
+				return
+			}
+			const productId = item.productId
+			if (!productId) {
+				this.$msg('花材信息缺失')
+				return
+			}
+			this.$util.confirmModal({ content: '确认取消特价?' }, () => {
+				let pendingMsg = ''
+				uni.showLoading({ mask: true })
+				cancelDiscountPrice({ id: productId }).then(res => {
+					if (res.code == 1) {
+						this.$set(this.flowersList[index], 'discountPrice', 0)
+						pendingMsg = res.msg || '取消成功'
+					}
+				}).finally(() => {
+					uni.hideLoading()
+					if (pendingMsg) {
+						setTimeout(() => {
+							this.$msg(pendingMsg)
+						}, 100)
+					}
+				})
+			})
+		},
 		savePrice(){
 			let that = this
 			let hasError = false
@@ -447,8 +527,10 @@ export default {
 			/* #else */
 			// 苹果微信小程序 iOS WebKit 特殊修复
 			-webkit-appearance: none;
+			appearance: none;
 			-webkit-tap-highlight-color: transparent;
 			-webkit-user-select: none;
+			user-select: none;
 			/* #endif */
 			/* #endif */
 		}
@@ -474,8 +556,10 @@ export default {
 				/* #ifdef APP-PLUS */
 				/* #else */
 				-webkit-appearance: none;
+				appearance: none;
 				-webkit-tap-highlight-color: transparent;
 				-webkit-user-select: none;
+				user-select: none;
 				/* #endif */
 				/* #endif */
 			}
@@ -483,16 +567,17 @@ export default {
 				border:1upx solid #3385FF;
 				color:#3385FF;
 			}
-			&.has-cancel-limit{
-				padding-right:72upx;
-			}
-			&.has-cancel-limit .price-input:last-of-type{
-				margin-right:10upx;
-			}
+		}
+		.cancel-action-row{
+			display:flex;
+			flex-direction:row;
+			flex-wrap:nowrap;
+			align-items:center;
+			margin:10upx 0;
+			width:100%;
 			.cancel-limit-btn{
 				flex-shrink:0;
 				padding:0 10upx;
-				margin-left:15upx;
 				height:60upx;
 				line-height:60upx;
 				font-size:24upx;
@@ -502,17 +587,37 @@ export default {
 				border-radius:6upx;
 				white-space:nowrap;
 			}
+			.cancel-action-btn{
+				flex-shrink:0;
+				padding:0 10upx;
+				margin-left:8upx;
+				height:60upx;
+				line-height:60upx;
+				font-size:24upx;
+				font-weight:bold;
+				color:#ffffff;
+				background:#d70021;
+				border-radius:6upx;
+				white-space:nowrap;
+			}
 			.limit-buy-tip{
-				position:absolute;
-				right:0;
-				top:0;
+				flex-shrink:0;
+				margin-left:8upx;
 				height:60upx;
 				line-height:60upx;
 				color:#ff4d4f;
 				font-size:24upx;
 				font-weight:bold;
 				white-space:nowrap;
-				z-index:1;
+			}
+			.action-tip{
+				flex-shrink:0;
+				margin-left:8upx;
+				height:60upx;
+				line-height:60upx;
+				color:#ff0025;
+				font-size:24upx;
+				white-space:nowrap;
 			}
 		}
 	}